second commit

chaos_201207
Luka Prinčič 2020-04-08 15:04:49 +02:00
parent 3cc98d930e
commit 2760c348b0
5 changed files with 354 additions and 6 deletions

295
ark_d.scd
View File

@ -1,15 +1,30 @@
// =========================================================== // ===========================================================
// Ark/D, amorphic (2020) // Ark/D, amorphic (2020)
// =========================================================== // ===========================================================
( (
// load libs
Server.default.waitForBoot { Server.default.waitForBoot {
// library path // library path
var libPath = PathName(thisProcess.nowExecutingPath.dirname +/+ "lib"); var libPath = PathName(thisProcess.nowExecutingPath.dirname +/+ "lib");
// samples path
var smpPath = PathName(thisProcess.nowExecutingPath.dirname +/+ "smp");
// load samples //
~smpBuffers.do(_.free); //- free all buffers so we don't accumulate?
~smpBuffers = List();
smpPath.filesDo({ |smpfile|
// tell me what you are loading:
postln("~~~ loading >" + smpfile.fileName + "<");
// add a sample into a buffer, store object to List
~smpBuffers.add(Buffer.readChannel(s, smpfile.fullPath, channels:[0]));
});
// load libs //
// for each files in that lib folder // for each files in that lib folder
libPath.filesDo({|afile| libPath.filesDo({|afile|
// tell me what you're executing: // tell me what you're executing:
@ -18,14 +33,114 @@ Server.default.waitForBoot {
// execute it: // execute it:
this.executeFile(afile.fullPath); this.executeFile(afile.fullPath);
}); });
}); });
s.meter;
s.scope(2);
s.plotTree
~smpBuffers.postln;
x = Synth(\softSaw);
y = Synth(\granulator, [\bufnum, ~smpBuffers.at(0)])
y.set(\amp,4)
y.set(\spread,1)
y.set(\pan, 0)
y.set(\gate, 0)
z = Synth(\bufPlayer, [\bufnum, ~smpBuffers.at(0)])
///////////////////////////////////////////////////////////////////////////////////////
//testng patterns
(
Pbind(
\instrument, \softSaw,
\octave, 2,
\degree, Pseq([2,5,4,1], inf),
\dur, 3,
\legato, 1,
\amp, 0.5,
\releaseTime, 0
).play;
)
////////////////////////////////////////////////////////////////////////////////////////
// PlayBufer:
(
SynthDef(\bufPlayer, {|out = 0, bufnum = 0 |
Out.ar(out,
PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum), loop: 1.0)
)
}).play(s, [\bufnum, ~smpBuffers.at(0)]);
)
~bufplay = Synth(\bufPlayer, [ \bufnum, ~smpBuffers.at(0)])
(
SynthDef(\granulator, {
arg out = 0, bufnum = ~smpBuffers.ar(0), dur=0.2, freq=140, amp=0.2;
var snd;
snd = GrainBuf.ar(numChannels: 2,
trigger: Impulse.kr(freq * LFNoise0.kr(freq).range(0.5,1.5)),
dur: dur,
sndbuf: bufnum,
rate: [0.2,0.3,0.4,0.5],
pos:LFTri.ar(0.0001, iphase:[0.5,1,0,2]).range(0,1),
interp: 4,
maxGrains: 1024,
pan: [
LFNoise1.kr(0.1).range(-1,1),
LFNoise1.kr(0.1).range(-1,1),
LFNoise1.kr(0.1).range(-1,1),
LFNoise1.kr(0.1).range(-1,1)
]
);
snd = Splay.ar(snd, spread:1);
Out.ar(out, snd * amp);
}).play;
)
~smpBuffers.do(_.free);
~smpBuffers.at(0).free;
s.meter
( (
SynthDef("sawM", { SynthDef("sawM", {
arg out=0, freq=140, gate=1, fadeTime=1, amp=0.5;
var snd, env;
snd = Saw.ar({freq/2 * LFNoise1.ar().range(0.95,1.05) } ! 2)
+ Saw.ar({freq * LFNoise1.ar().range(0.95,1.05) } ! 2, )
//+ (Saw.ar({freq * 2 * LFNoise1.ar().range(0.95,1.05) } ! 2) * 0.4)
// + (Saw.ar({freq * 4 * LFNoise1.ar().range(0.95,1.05) } ! 2) * 0.2)
;
//snd = Saw.ar({freq/2 * LFNoise1.ar().range(0.95,1.05)} ! 4);
//snd = snd + Saw.ar([freq/2,freq]/2 * LFNoise1.ar().range(0.95,1.05))!3;
snd = Splay.ar(snd, spread:1, level:1, center:0);
env = EnvGen.kr( Env([0, 1, 0], [fadeTime, fadeTime], \sin, 1),
gate, doneAction: Done.freeSelf);
snd = snd * env * amp;
Out.ar(out, snd);
}).play; }).play;
); );
s.scope
// load samples // load samples
@ -35,4 +150,172 @@ SynthDef("sawM", {
// load patterns // load patterns
2.rand
(
x = { arg spread=1, level=1, center=0.0;
Splay.ar(
SinOsc.ar( { |i| LFNoise2.kr(1).exprange(200, 4000) } ! 10),
spread,
level,
center
);
}.play;
)
b = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
(
x = {
arg out = 0, bufnum, dur=0.2, freq=140, amp=0.5;
var snd;
snd = GrainBuf.ar(numChannels: 2,
trigger: Impulse.kr(freq * LFNoise0.kr(freq).range(0.5,1.5)),
dur: dur,
sndbuf: bufnum,
rate: [0.2,0.3,0.4,0.5],
pos:LFTri.ar(0.01, iphase:[0.5,1,0,2]).range(0,1),
interp: 4
);
//snd = [snd.at(0),snd.at(1)] + [snd.at(3),snd.at(2)] * 0.2;
snd = Splay.ar(snd * amp, spread:1);
//Mix(snd * 0.25);
//Out.ar(out, snd);
}.play(s,[\bufnum, b]);
)
s.scope
{ Mix.new([ PinkNoise.ar(0.1), FSinOsc.ar(801, mul:0.1), LFSaw.ar(40, mul:0.1)]) }.play
play({
VarSaw.ar(
LFPulse.kr(3, 0, 0.3, 200, 200),
0,
LFTri.kr(1.0).range(0,1), //width
0.1)
});
(
play({
VarSaw.ar([50,50.5], 0, SinOsc.kr(0.01,1).range(0.05,0.95), 0.5)!2
+ VarSaw.ar([101,99.3], 0, SinOsc.kr(0.06,0).range(0.2,0.8) , 0.5)!2 * 0.2
});)
(
SynthDef(\softSaw, {
arg out = 0, freq = 40, detune = 0.1, amp = 1, pan = 0,
gate = 1, attackTime = 0.1, susLevel = 1.0, releaseTime = 1.0;
var env, snd;
detune = detune * 0.1;
amp = amp * 0.4;
env = Linen.kr(gate, attackTime, susLevel, releaseTime);
snd = VarSaw.ar(
freq: [freq, freq * (1.003+detune)],
width: SinOsc.kr(0.01,0.2).range(0.05,0.095));
snd = snd + VarSaw.ar(
freq: [(freq*2 * (1.001-detune)),(freq*2 * (1+detune))],
width: SinOsc.kr(0.06,0.8).range(0.2,0.8));
snd = Balance2.ar(snd.at(0), snd.at(1), pos: pan);
snd = snd * amp * env;
Out.ar(out, snd);
}).play);
Linen.kr()
(
SynthDef(\granulator, {
arg out = 0, bufnum = ~smpBuffers.ar(0), grainDur=0.2, grainFreq=140, amp=0.8,
gate = 1, attackTime = 0.1, susLevel = 1.0, releaseTime = 1.0,
spread = 1, pan = 0, seed = 1924, id=0;
var snd, env;
RandID.ir(id);
RandSeed.ir(1, seed);
spread = spread * abs(abs(pan)-1);
env = Linen.kr(gate, attackTime, susLevel, releaseTime);
snd = GrainBuf.ar(numChannels: 1,
trigger: Impulse.kr(grainFreq * LFNoise0.kr(grainFreq).range(0.5,1.5)),
dur: grainDur,
sndbuf: bufnum,
rate: [0.2,0.3,0.4,0.5],
pos:LFTri.ar(0.0001, iphase:[IRand(0,1),IRand(0,1),IRand(0,1),IRand(0,1)]).range(0,1),
interp: 4,
maxGrains: 1024,
pan: [ LFNoise1.kr(0.1).range(-1,1),
LFNoise1.kr(0.1).range(-1,1),
LFNoise1.kr(0.1).range(-1,1),
LFNoise1.kr(0.1).range(-1,1) ]
);
snd = Splay.ar(snd, spread:spread, level:amp, center: pan);
snd = snd * env;
Out.ar(out, snd);
}).play;
);
spread
(
x = { arg spread=1, level=0.2, center=0.0;
Splay.ar(
SinOsc.ar( { |i| LFNoise2.kr(1).exprange(200, 4000) } ! 2, mul: { LFNoise2.kr(1).exprange(0.01,1)}!2),
spread,
level,
center
);
}.play;
)
x.set(\spread, 1, \center, 0); // full stereo
x.set(\spread, 0.5, \center, 0); // less wide
x.set(\spread, 0, \center, 0); // mono center
x.set(\spread, 0.5, \center, 0.5);
// spread from center to right
x.set(\spread, 0, \center, -1); // all left
x.set(\spread, 1, \center, 0); // full stereo

7
lib/bufPlayer.scd Normal file
View File

@ -0,0 +1,7 @@
(
SynthDef(\bufPlayer, {|out = 0, bufnum = 0 |
Out.ar(out,
PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum), loop: 1.0)
)
}).add;
);

32
lib/granulators.scd Normal file
View File

@ -0,0 +1,32 @@
(
SynthDef(\granulator, {
arg out = 0, bufnum = ~smpBuffers.ar(0), grainDur=0.2, grainFreq=140, amp=0.8,
gate = 1, attackTime = 0.1, susLevel = 1.0, releaseTime = 1.0,
spread = 1, pan = 0, seed = 1924, id=0;
var snd, env;
RandID.ir(id);
RandSeed.ir(1, seed);
spread = spread * abs(abs(pan)-1);
env = Linen.kr(gate, attackTime, susLevel, releaseTime);
snd = GrainBuf.ar(numChannels: 1,
trigger: Impulse.kr(grainFreq * LFNoise0.kr(grainFreq).range(0.5,1.5)),
dur: grainDur,
sndbuf: bufnum,
rate: [0.2,0.3,0.4,0.5],
pos:LFTri.ar(0.0001, iphase:[IRand(0,1),IRand(0,1),IRand(0,1),IRand(0,1)]).range(0,1),
interp: 4,
maxGrains: 1024,
pan: [ LFNoise1.kr(0.1).range(-1,1),
LFNoise1.kr(0.1).range(-1,1),
LFNoise1.kr(0.1).range(-1,1),
LFNoise1.kr(0.1).range(-1,1) ]
);
snd = Splay.ar(snd, spread:spread, level:amp, center: pan);
snd = snd * env;
Out.ar(out, snd);
}).add;
);

26
lib/softSaw.scd Normal file
View File

@ -0,0 +1,26 @@
(
SynthDef(\softSaw, {
arg out = 0, freq = 40, oscdetune = 0.1, amp = 1, pan = 0,
gate = 1, attackTime = 0.1, susLevel = 1.0, releaseTime = 1.0;
var env, snd;
oscdetune = oscdetune * 0.1;
amp = amp * 0.4;
env = Linen.kr(gate, attackTime, susLevel, releaseTime, doneAction:2);
snd = VarSaw.ar(
freq: [freq, freq * (1.003 + oscdetune)],
width: SinOsc.kr(0.01,0.2).range(0.05,0.095));
snd = snd + VarSaw.ar(
freq: [(freq*2 * (1.001 - oscdetune)),(freq*2 * (1 + oscdetune))],
width: SinOsc.kr(0.06,0.8).range(0.2,0.8));
snd = Balance2.ar(snd.at(0), snd.at(1), pos: pan);
snd = snd * amp * env;
Out.ar(out, snd);
}).add;
);