Permalink
Browse files

added env control

  • Loading branch information...
1 parent 0bc5059 commit 4ed7306bb184abda2b7c2ec55984a3413f1dccbe @grirgz committed May 22, 2012
Showing with 3,872 additions and 918 deletions.
  1. +74 −0 crap14.sc
  2. +657 −0 crap15.sc
  3. +465 −0 crap16.sc
  4. +59 −13 eventscore.sc
  5. +12 −3 keycode.sc
  6. +60 −4 live10.sc
  7. +1 −1 live11.sc
  8. +134 −0 live12.sc
  9. +558 −0 live13.sc
  10. +130 −0 live14.sc
  11. +7 −1 live9.sc
  12. +174 −34 main.sc
  13. +15 −3 midi.sc
  14. +835 −0 node_manager.sc
  15. +117 −15 param.sc
  16. +174 −376 player.sc
  17. +15 −6 samplelib.sc
  18. +132 −460 side.sc
  19. +2 −2 synth.sc
  20. +163 −0 synthpool.sc
  21. +88 −0 tap.sc
View
74 crap14.sc
@@ -327,3 +327,77 @@ Pdefn
)
+1+1
+~res.printAll
+~res4.free
+~res4 = nil
+~res2
+(
+~res4 = 500.collect { arg i;
+ ~make_player_from_synthdef.(~seq, \lead2)
+};
+)
+
+0.5.coin
+(
+100.collect {
+ if(0.5.coin) { 1 } { 0 }
+}
+)
+
+
+
+(// * //watch the postWindow
+ a=["m","x","f","k","d","p"];
+ x=Array;
+ y=x.newClear(6);
+~mxfkdp=Task({
+ inf.do({
+ y.put(x.series(6,0,1).choose,a.scramble).postln;
+ 0.03.wait;
+ })
+}).play;
+
+m=fork({
+ inf.do({
+ //"array num:".postcln;
+ if(y[x.series(6,0,1).choose]==a, {
+ "lo encontraste!/found it!".postcln;
+ { GVerb.ar(
+ EnvGen.ar(Env.perc(0.01,8),1,doneAction:2)*
+ Blip.ar(XLine.kr(440,1600,8)),50,10,0.02)
+ }.play;
+ ~mxfkdp.stop;
+ m.stop;
+ },{
+ //"buscando.../seeking...".postcln;
+ });
+ 0.03.wait
+ })
+});
+);
+//.SCtweetLong
+
+
+
+
+{CombC.ar(Klang.ar(`[[100,101,1000,1001]],1,0)*0.1,0.33,LFTri.ar(0.1, 0, 0.1, 0.11)+LFTri.ar(0.17, 0, 0.1, 0.22),10)!2}.play;
+
+
+
+//Variation
+
+{CombC.ar(Klang.ar(`[[100,101,1000,1001]],1,0)*0.1,1.33,LFTri.ar(0.3, 0, 0.1, 0.71)+LFTri.ar(0.7, 0, 0.1, 0.52),10)!2}.play;
+
+
+(
+PfadeOut(PfadeIn(Pbind(
+ \instrument, \pulsepass,
+ \freq, 200,
+ \dur, 1,
+ \bla, Pfunc{"bla".postln},
+ \amp, 0.1
+),2),2,~bla).play;
+)
+~bla = inf
+~bla = 0
View
657 crap15.sc
@@ -0,0 +1,657 @@
+ULib.startup;
+GUI.qt
+GUI.swing
+s.boot
+
+
+
+b = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
+
+(
+SynthDef("help-magMul", { arg out=0;
+ var inA, chainA, inB, chainB, chain;
+ inA = WhiteNoise.ar(0.2);
+ inB = LFSaw.ar(100, 0, 0.2);
+ chainA = FFT(LocalBuf(2048), inA);
+ chainB = FFT(LocalBuf(2048), inB);
+ chain = PV_MagMul(chainA, chainB);
+ Out.ar(out, 0.1 * IFFT(chain).dup);
+}).play(s);
+)
+
+(
+SynthDef("help-magMul2", { arg out=0, soundBufnum=2;
+ var inA, chainA, inB, chainB, chain;
+ var ou;
+ inA = LFSaw.ar([100, 150], 0, 0.2);
+ inA = LFSaw.ar(100, 0, 0.2);
+ inA = SinOsc.ar([400,500]);
+
+ inA = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum)*1/2, loop: 1);
+ inB = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);
+ chainA = FFT(LocalBuf(2048), inA);
+ chainB = FFT(LocalBuf(2048), inB);
+ chain = PV_MagMul(chainA, chainB);
+ ou = IFFT(chain);
+ ou = LPF.ar(ou, 500);
+ Out.ar(out, 0.43 * ou ! 2);
+}).play(s, [\soundBufnum, b.bufnum]);
+)
+
+b.free
+
+
+(
+SynthDef("help-mul", { arg out=0;
+ var inA, chainA, inB, chainB, chain ;
+ inA = SinOsc.ar(500, 0, 0.5);
+ inB = SinOsc.ar(Line.kr(100, 400, 5), 0, 0.5);
+ chainA = FFT(LocalBuf(2048), inA);
+ chainB = FFT(LocalBuf(2048), inB);
+ chain = PV_Mul(chainA, chainB);
+ Out.ar(out, 0.1 * IFFT(chain).dup);
+}).play(s);
+s.scope;
+)
+
+(
+SynthDef("help-mul2", { arg out=0;
+ var inA, chainA, inB, chainB, chain ;
+ inA = SinOsc.ar(500, 0, 0.5) * Line.kr;
+ inB = LFNoise1.ar(20);
+ chainA = FFT(LocalBuf(2048), inA);
+ chainB = FFT(LocalBuf(2048), inB);
+ chain = PV_Mul(chainA, chainB);
+ Out.ar(out, 0.1 * IFFT(chain).dup);
+}).play(s);
+s.scope;
+)
+
+
+
+(
+SynthDef("help-add", { arg out=0, soundBufnum;
+ var inA, chainA, inB, chainB, chain ;
+ var ou;
+ inA = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);
+ inB = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum) * 0.5, loop: 1);
+ chainA = FFT(LocalBuf(2048), inA);
+ chainB = FFT(LocalBuf(2048), inB);
+ chain = PV_Add(chainA, chainB);
+ ou = IFFT(chain);
+ ou = inA + inB;
+ Out.ar(out, 0.1 * ou.dup);
+}).play(s, [\soundBufnum, b.bufnum]);
+)
+
+
+
+ d = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
+
+//// crossfade between original and magmul-ed whitenoise
+(
+x = { var in, in2, chain, chainB, chainC;
+ in = PlayBuf.ar(1, d, BufRateScale.kr(d), loop: 1) * 2;
+ in2 = WhiteNoise.ar;
+ chain = FFT(LocalBuf(2048), in);
+ chainB = FFT(LocalBuf(2048), in2);
+ chainC = PV_Copy(chain, LocalBuf(2048));
+ chainB = PV_MagMul(chainB, chainC);
+ XFade2.ar(IFFT(chain), IFFT(chainB) * 0.1, SinOsc.kr(0.1, 1.5pi)) ! 2;
+}.play(s);
+)
+x.free;
+
+
+
+
+//// as previous but with Blip for 'vocoder' cross synthesis effect
+(
+x = { var in, in2, chain, chainB, chainC;
+ in = PlayBuf.ar(1, d, BufRateScale.kr(d), loop: 1) * 2;
+ in2 = Blip.ar(100, 50);
+ chain = FFT(LocalBuf(2048), in);
+ chainB = FFT(LocalBuf(2048), in2);
+ chainC = PV_Copy(chain, LocalBuf(2048));
+ chainB = PV_MagMul(chainB, chainC);
+ XFade2.ar(IFFT(chain), IFFT(chainB) * 0.1, SinOsc.ar(0.1)) ! 2;
+}.play(s);
+)
+x.free;
+
+
+//// Spectral 'pan'
+(
+x = { var in, chain, chainB, pan;
+ in = PlayBuf.ar(1, d, BufRateScale.kr(d), loop: 1);
+ chain = FFT(LocalBuf(2048), in);
+ chainB = PV_Copy(chain, LocalBuf(2048));
+ pan = MouseX.kr(0.001, 1.001, 'exponential') - 0.001;
+ chain = PV_BrickWall(chain, pan);
+ chainB = PV_BrickWall(chainB, -1 + pan);
+ 0.5 * IFFT([chain, chainB]);
+}.play(s);
+)
+x.free;
+
+
+(
+s.waitForBoot {
+ b = Buffer.alloc(s,2048,1);
+ c = Buffer.alloc(s,2048,1);
+ d = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
+ e = Buffer.alloc(s,2048,1);
+ f = Buffer.alloc(s,2048,1);
+}
+)
+
+
+//// proof of concept
+(
+x = { var inA, chainA, inB, chainB, chain;
+ inA = LFClipNoise.ar(100);
+ chainA = FFT(b, inA);
+ chainB = PV_Copy(chainA, c);
+ IFFT(chainA) - IFFT(chainB); // cancels to zero so silent!
+}.play(s);
+)
+x.free;
+// IFFTed frames contain the same windowed output data
+b.plot(\b, Rect(200, 430, 700, 300)); c.plot(\c, Rect(200, 100, 700, 300));
+GUI.qt
+
+
+
+//// Multiple Magnitude plots
+(
+x = { var in, chain, chainB, chainC;
+ in = WhiteNoise.ar;
+ chain = FFT(b, in);
+ PV_Copy(chain, LocalBuf(2048)); // initial spectrum
+ chain = PV_RectComb(chain, 20, 0, 0.2);
+ PV_Copy(chain, LocalBuf(2048)); // after comb
+ 2.do({chain = PV_MagSquared(chain)});
+ PV_Copy(chain, LocalBuf(2048)); // after magsquared
+ 0.00001 * Pan2.ar(IFFT(chain));
+}.play(s);
+)
+x.free;
+
+(
+c.getToFloatArray(action: { arg array;
+ var z, x;
+ z = array.clump(2).flop;
+ // Initially data is in complex form
+ z = [Signal.newFrom(z[0]), Signal.newFrom(z[1])];
+ x = Complex(z[0], z[1]);
+ {x.magnitude.plot('Initial', Rect(200, 560, 700, 200))}.defer
+});
+e.getToFloatArray(action: { arg array;
+ var z, x;
+ z = array.clump(2).flop;
+ // RectComb doesn't convert, so it's still complex
+ z = [Signal.newFrom(z[0]), Signal.newFrom(z[1])];
+ x = Complex(z[0], z[1]);
+ {x.magnitude.plot('After RectComb', Rect(200, 330, 700, 200))}.defer
+});
+f.getToFloatArray(action: { arg array;
+ var z, x;
+ z = array.clump(2).flop;
+ // MagSquared converts to Polar
+ x = Signal.newFrom(z[0]); // magnitude first
+ {x.plot('After MagSquared', Rect(200, 100, 700, 200))}.defer
+})
+)
+
+[b, c, d, e, f].do(_.free); // free the buffers
+
+
+
+s.boot;
+
+(
+b = Buffer.alloc(s,2048,1);
+c = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
+)
+
+(
+SynthDef("help-binStretch", { arg out=0, bufnum=0;
+ var in, chain;
+ in = LFSaw.ar([200,200+SinOsc.kr(0.1)], 0, 0.2).sum;
+ chain = FFT(bufnum, in);
+ chain = PV_BinShift(chain, MouseX.kr(0.25, 4, \exponential) );
+ Out.ar(out, 0.5 * IFFT(chain).dup);
+}).play(s,[\out, 0, \bufnum, b.bufnum]);
+)
+
+(
+SynthDef("help-binStretch2", { arg out=0, bufnum=0, soundBufnum=2;
+ var in, chain;
+ //in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);
+ in = AudioIn.ar(1,0.5);
+ chain = FFT(bufnum, in);
+ chain = PV_BinShift(chain, MouseX.kr(0.25, 4, \exponential) );
+ Out.ar(out, 0.5 * IFFT(chain).dup);
+}).play(s,[\out, 0, \bufnum, b.bufnum, \soundBufnum, c.bufnum]);
+)
+
+(
+SynthDef("help-binStretch2", { arg out=0, bufnum=0, soundBufnum=2;
+ var in, chain1, chain2;
+ var in2, in3, ou;
+ //in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);
+ in = AudioIn.ar(1,0.5);
+ in2 = LPF.ar(in, 500);
+ in3 = HPF.ar(in, 500);
+ chain1 = FFT(LocalBuf(2048), in);
+ chain1 = PV_BinShift(chain1, MouseX.kr(0.25, 4, \exponential) );
+ chain2 = FFT(LocalBuf(2048), in);
+ chain2 = PV_BinShift(chain2, MouseY.kr(0.25, 4, \exponential) );
+ ou = IFFT(chain1) + IFFT(chain2);
+ Out.ar(out, 0.5 * ou.dup);
+}).play(s,[\out, 0, \bufnum, b.bufnum, \soundBufnum, c.bufnum]);
+)
+
+(
+SynthDef("help-binShift", { arg out=0, bufnum=0;
+ var in, chain;
+ in = LFSaw.ar(200, 0, 0.2);
+ chain = FFT(bufnum, in);
+ chain = PV_BinShift(chain, 1, MouseX.kr(-128, 128) );
+ Out.ar(out, 0.5 * IFFT(chain).dup);
+}).play(s,[\out, 0, \bufnum, b.bufnum]);
+)
+
+(
+SynthDef("help-binShift2", { arg out=0, bufnum=0, soundBufnum=2;
+ var in, chain;
+ in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);
+ chain = FFT(bufnum, in);
+ chain = PV_BinShift(chain, 1, MouseX.kr(-128, 128) );
+ Out.ar(out, 0.5 * IFFT(chain).dup);
+}).play(s,[\out, 0, \bufnum, b.bufnum, \soundBufnum, c.bufnum]);
+)
+
+
+
+(
+SynthDef("help-binWipe", { arg out=0;
+ var inA, chainA, inB, chainB, chain;
+ inA = WhiteNoise.ar(0.2);
+ inB = LFSaw.ar(100, 0, 0.2);
+ chainA = FFT(LocalBuf(2048), inA);
+ chainB = FFT(LocalBuf(2048), inB);
+ chain = PV_BinWipe(chainA, chainB, MouseX.kr(-1, 1));
+ Out.ar(out, 0.1 * IFFT(chain).dup);
+}).play(s);
+)
+
+(
+SynthDef("help-binWipe2", { arg out=0, soundBufnum=2;
+ var inA, chainA, inB, chainB, chain;
+ inA = WhiteNoise.ar(0.2);
+ inA = LFSaw.ar(100, 0, 0.2);
+ inB = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);
+ chainA = FFT(LocalBuf(2048), inA);
+ chainB = FFT(LocalBuf(2048), inB);
+ chain = PV_BinWipe(chainA, chainB, MouseX.kr(-1, 1));
+ Out.ar(out, 0.1 * IFFT(chain).dup);
+}).play(s, [\soundBufnum, c]);
+)
+
+
+
+
+//explore the effect
+(
+SynthDef("conformer1", { arg soundBufnum;
+ var in, chain;
+ in = AudioIn.ar(1,0.5);
+ //in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);
+ chain = FFT(LocalBuf(1024), in);
+ chain=PV_ConformalMap(chain, MouseX.kr(-1.0,1.0), MouseY.kr(-1.0,1.0));
+ Out.ar(0, Pan2.ar(IFFT(chain),0));
+}).add;
+)
+
+a = Synth("conformer1", [\soundBufnum, c])
+a.free
+
+(
+SynthDef("conformer2", {
+ var in, chain, out;
+ in = Mix.ar(LFSaw.ar(SinOsc.kr(Array.rand(3,0.1,0.5),0,10,[1,1.1,1.5,1.78,2.45,6.7]*220),0,0.3));
+ chain = FFT(LocalBuf(2048), in);
+ chain=PV_ConformalMap(chain, MouseX.kr(0.01,2.0, 'exponential'), MouseY.kr(0.01,10.0, 'exponential'));
+ out=IFFT(chain);
+
+ Out.ar(0, Pan2.ar(CombN.ar(out, 0.1, 0.1, 10, 0.5, out), 0, 0.3));
+}).add;
+)
+
+a = Synth("conformer2")
+a.free
+
+
+
+
+(
+b = Buffer.alloc(s,2048,1);
+c = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
+)
+
+(
+//trig with MouseY
+SynthDef("help-diffuser", { arg out=0, bufnum=0 ;
+ var in, chain;
+ in = Mix.ar(SinOsc.ar(200 * (1..10), 0, Array.fill(10, {rrand(0.1, 0.2)}) ));
+ chain = FFT(bufnum, in);
+ chain = PV_Diffuser(chain, MouseY.kr > 0.5 );
+ Out.ar(out, 0.5 * IFFT(chain).dup);
+}).play(s,[\out, 0, \bufnum, b.bufnum ]);
+)
+
+(
+//trig with MouseY
+SynthDef("help-diffuser2", { arg out=0, bufnum=0, soundBufnum=2;
+ var in, chain;
+ in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);
+ chain = FFT(bufnum, in);
+ chain = PV_Diffuser(chain, MouseY.kr > 0.5 );
+ Out.ar(out, 0.5 * IFFT(chain).dup);
+}).play(s,[\out, 0, \bufnum, b.bufnum, \soundBufnum, c.bufnum]);
+)
+
+
+
+
+
+b = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
+
+
+(
+SynthDef("help-magFreeze", { arg out=0;
+ var in, chain;
+ in = SinOsc.ar(LFNoise1.kr(5.2,250,400));
+ chain = FFT(LocalBuf(2048), in);
+ // moves in and out of freeze
+ chain = PV_MagFreeze(chain, SinOsc.kr(0.2) );
+ Out.ar(out, 0.1 * IFFT(chain).dup);
+}).play(s);
+
+)
+
+(
+//trig with MouseY
+SynthDef("help-magFreeze2", { arg out=0, soundBufnum=2;
+ var in, chain;
+ in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);
+ chain = FFT(LocalBuf(2048), in);
+ //chain = PV_MagFreeze(chain, MouseY.kr > 0.5 );
+ chain = PV_MagFreeze(chain, SinOsc.kr(5)+0.5 );
+ Out.ar(out, 0.1 * IFFT(chain).dup);
+}).play(s,[\soundBufnum, b]);
+)
+
+
+
+b = Buffer.alloc(s,2048,1);
+
+(
+SynthDef("help-rectcomb", { arg out=0, bufnum=0;
+ var in, chain;
+ in = {WhiteNoise.ar(0.2)}.dup;
+ chain = FFT(bufnum, in);
+ chain = PV_RectComb(chain, 8, LFTri.kr(0.097, 0, 0.4, 0.5),
+ LFTri.kr(0.24, 0, -0.5, 0.5));
+ Out.ar(out, IFFT(chain).dup);
+}).play(s,[\out, 0, \bufnum, b.bufnum]);
+)
+
+(
+SynthDef("help-rectcomb2", { arg out=0, bufnum=0;
+ var in, chain;
+ var ou, env;
+ in = WhiteNoise.ar(0.2);
+ env = EnvGen.ar(Env.new([0.0,0.8,0.1],[0.19,0.01]),LFPulse.ar(2, 0, 0.4));
+ chain = FFT(bufnum, in);
+ chain = PV_RectComb(chain, 1, env, 0.1);
+ ou = IFFT(chain);
+ ou = LPF.ar(ou, 1700);
+ Out.ar(out, ou.dup);
+}).play(s,[\out, 0, \bufnum, b.bufnum]);
+)
+
+
+
+
+//series of numbers
+Server.default.boot;
+(
+SynthDef(\beep, { |freq=440, cutoff=1000, pan=0|
+ Out.ar(0, Pan2.ar(LPF.ar(Saw.ar(freq*Array.rand(2,0.99,1.01)).sum, cutoff*Array.rand(5,0.8,1.2)).sum, pan)) }).send(s);
+)
+
+//from 1 to 100
+//while number>1
+//if even: divide by 2, else multiply by 3 and add 1
+//remember highest value, remember longest series, both with their startnumber
+//startnumber->cutoff, number-> frequency, pan mid
+//startnumber->cutoff, highest value -> frequency, pan right
+//startnumber->cutoff, longest series -> cutoff, pan left
+(
+var highest=1, longest=1, starthighest=1, startlongest=1;
+var numberbeep, highestbeep, longestbeep;
+numberbeep=Synth(\beep, [\freq, 200, \cutoff, 200, \pan, 0]);
+longestbeep=Synth(\beep, [\freq, 200, \cutoff, 200, \pan, -1]);
+highestbeep=Synth(\beep, [\freq, 200, \cutoff, 200, \pan, 1]);
+Routine({
+ for (50, 100, { arg startnumber;
+ var number, length=1, maximum;
+ number=startnumber;
+ maximum=startnumber;
+ (number.asString+" ").post;
+ numberbeep.set(\cutoff, 100*startnumber);
+ while ( {number>1},{
+ if (number.asInteger.even, {number=(number/2)}, {number=3*number+1});
+ length=length+1;
+ if (number>maximum, {maximum=number});
+ numberbeep.set(\freq, 30+number);
+ longestbeep.set(\freq, 75*length);
+ highestbeep.set(\freq, 30+maximum);
+ 0.1.wait;
+ });
+ if(length>longest, {longest=length; startlongest=startnumber});
+ if (maximum>highest, {highest=maximum; starthighest=startnumber});
+ longestbeep.set(\cutoff, 100*longest);
+ highestbeep.set(\cutoff, highest*2);
+ ("length: "+length.asString).post;
+ (" maximum: " + maximum.asString).postln;
+ });
+ postf("longest series % at % \n", longest, startlongest);
+ postf("highest value % at % \n", highest, starthighest);
+ numberbeep.set(\freq, 30, \cutoff, 10000);
+ longestbeep.set(\freq, 75*longest, \cutoff, 100*startlongest);
+ highestbeep.set(\freq, 30+highest, \cutoff, 100*starthighest);
+ 10.wait;
+ numberbeep.free;
+ highestbeep.free;
+ longestbeep.free;
+}).play;
+)
+
+
+
+
+
+(
+b = Buffer.alloc(s,2048,1);
+c = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
+d = Buffer.alloc(s,2048,1);
+)
+
+(
+SynthDef(\help_pvconj, { arg out=0, bufnum=0, soundBufnum=2;
+ var in, chain;
+ in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);
+ chain = FFT(bufnum, in);
+ chain = PV_Conj(chain);
+ // Original is left, conj is right
+ Out.ar(out, 0.3 * [in, IFFT(chain)]);
+}).play(s,[\out, 0, \bufnum, b, \soundBufnum, c]);
+)
+
+(
+SynthDef(\help_pvconj2, { arg out=0, bufnum=0, soundBufnum=2;
+ var in, chainA, chainB;
+ in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);
+ chainA = FFT(bufnum, in);
+ chainB = PV_Copy(chainA, d);
+ chainB = PV_Conj(chainB);
+ // Now we have the original and conjugate, what happens if we add them?
+ Out.ar(out, 0.3 * (IFFT(PV_Add(chainA, chainB)).dup));
+}).play(s,[\out, 0, \bufnum, b, \soundBufnum, c]);
+)
+
+
+s.boot
+(
+s.doWhenBooted {
+c = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
+}
+)
+
+(
+x = {
+ var fftsize = 1024;
+ var in, chain, in2, chain2, out;
+ in = PlayBuf.ar(1, c, BufRateScale.kr(c), loop: 1);
+ chain = FFT(LocalBuf(fftsize), in);
+
+ // in2 = PlayBuf.ar(1, e, BufRateScale.kr(e), loop: 1);
+ // JMcC babbling brook
+ in2 = ({
+ RHPF.ar(OnePole.ar(BrownNoise.ar, 0.99), LPF.ar(BrownNoise.ar, 14)
+ * 400 + 500, 0.03, 0.003)}!2)
+ + ({RHPF.ar(OnePole.ar(BrownNoise.ar, 0.99), LPF.ar(BrownNoise.ar, 20)
+ * 800 + 1000, 0.03, 0.005)}!2
+ )
+ * 4;
+ chain2 = FFT(LocalBuf(fftsize), in2);
+
+ chain = chain.pvcalc2(chain2, fftsize, {|mags, phases, mags2, phases2|
+ [mags * mags2 / 10, phases2 + phases]
+ }, frombin: 0, tobin: 125, zeroothers: 0);
+
+ out = IFFT(chain);
+ Out.ar(0, 0.5 * out.dup);
+}.play(s);
+)
+x.free;
+
+
+(
+Ndef(\bla, {
+ var ou, bla;
+ ou = Mix.fill(10, { arg i;
+ i = i*100+50;
+ SinOsc.ar(
+ //RHPF.ar(OnePole.ar(SinOsc.ar(SinOsc.ar(140).range(10,500)), 0.99), LPF.ar(BrownNoise.ar, 44).exprange(50,500), 0.101, 0.3).range(1+i,2+i)
+ SinOsc.ar(i)
+ )
+ }) ! 2;
+ bla = LPF.ar(BrownNoise.ar, 74);
+ ou = ou * 100;
+ //ou = RLPF.ar(ou, bla.range(100,1500), LPF.ar(bla,15.99).range(0.001,2));
+ //ou = RLPF.ar(ou, bla.range(170,500),0.1);
+ //ou = LPF.ar(ou, 500);
+ ou;
+}).play
+)
+(
+{
+ OnePole.ar(BrownNoise.ar, 0.9919) ! 2
+}.play
+)
+
+
+(
+SynthDef(\fm1, { arg out=0, amp=0.1, gate=1, pan=0, freq=200, fmod=0.25, modbias=0, modratio=0.9, rq=0.001, fdelta=0.0005, mix=1, modmix=0;
+ var ou, ou2, ou3, modulator;
+ var env;
+ var mul;
+ var env1, env2, env3;
+ //env = EnvGen.ar(Env.new([0,1,0],[0.001,0.05],-9,1),gate,doneAction:2);
+
+ env = EnvGen.ar(~make_adsr.(\adsr),gate, doneAction:2);
+ env1 = EnvGen.ar(Env.new([1,1/10,1],[0.01,0.42],0,1),gate,levelBias:modbias,levelScale:freq*fmod);
+ env2 = EnvGen.ar(Env.new([0.0,1,0],[0.001,0.4],0,1),gate,levelBias:0,levelScale:modratio);
+ env3 = EnvGen.ar(Env.new([0,1,0],[0.0001,0.44]),gate,levelBias:0,levelScale:0.1);
+ //env1 = freq*fmod+modbias;
+ //env2 = modratio;
+ //freq = SinOsc.ar(11)*(freq*env3)+freq;
+ //amp = SinOsc.ar(11,0.5pi)*(amp*0.2)+amp;
+ //delta = 0.0005;
+ mul = [1];
+ mul = [1+fdelta,1,1-fdelta,1+(fdelta/2)];
+ modulator = [
+ SinOsc.ar(env1),
+ LFTri.ar(env1),
+ LFSaw.ar(env1),
+ ];
+ modulator = SelectX.ar(modmix, modulator);
+ ou = (LFPulse.ar(modulator*(freq*env2)+freq*mul)/mul.size).sum;
+ ou2 = (SinOsc.ar(modulator*(freq*env2)+freq*mul)/mul.size).sum;
+ ou3 = (LFSaw.ar(modulator*(freq*env2)+freq*mul)/mul.size).sum;
+ ou = SelectX.ar(mix*3, [ou,ou2, ou3]);
+ //ou = RLPF.ar(ou, freq*[0.25,0.5,1,2], rq, [0.01,0.041,0.7,0.1]).sum;
+ ou = RLPF.ar(ou, freq, rq, 1);
+ //ou = (ou/4 ).distort;
+ ou = ou /2;
+ ou = ou * env;
+ ou = Pan2.ar(ou, pan, amp);
+ Out.ar(out, ou);
+},metadata:(
+ specs:(
+ modmix: \mix
+ )
+)).add;
+)
+
+(
+Pdef(\plop, Pbind(
+ \instrument, \test1,
+ \degree, Pseq([0,2,4,2]+0,inf)+Pseg(Pseq([4,0,1,3],inf),2,\step),
+ \degree, Pseq([0,\rest],inf),
+ \degree, Pseq([0,Prand([\rest,2,7]),4,2]+0,inf)+Pseg(Pseq([4,0,3,1],inf),2,\step),
+ \mtranspose, 1,
+ \fdelta, 0.0001,
+ \octave, 5,
+ \fmod, Pseg(Pseq([1/4,1/2,1/8],inf),1.8),
+ \fmod, 1.6514,
+ \fmod, 2/1,
+ \mix, Pseg(Pseq([0,1],inf),2),
+ \modmix, Pseg(Pseq([0,1],inf),0.71),
+ //\modmix, 0.5,
+ \modbias, 000,
+ \modratio, 00.990,
+ \rq, 0.57,
+ \legato, 0.5,
+ \dur, 2/8,
+ \amp, 0.05
+)).play;
+)
+
+s.levels
+s.meter
+s.boot
+
+~seq.focus_window
+~seq.panels.side.window.view.focus(true)
+(
+Mdef(\bla, Pbind(
+ \instrument, \fm1
+))
+)
+
+~seq.model.velocity_ratio = 1.0
View
465 crap16.sc
@@ -0,0 +1,465 @@
+play{a=Mix(Array.fill(75,{|i|SinOsc.ar(rrand(1,50)*i+10,0,LFNoise1.kr([1.8,2.3]))}))*0.02;CombL.ar(a,15,SinOsc.ar([0.1,0.11],0,0.5,0.6),10)}
+o = Server.default.options;
+o.memSize = 8192 * 2
+o.memSize
+s.quit
+s.boot
+
+
+
+(
+w = Window("screensaver", Window.screenBounds).front;
+w.view.keyDownAction = { w.close };
+u = UserView(w, w.view.bounds);
+u.background = Color.black;
+u.animate = true;
+u.clearOnRefresh = false;
+u.drawFunc = { |u|
+ var width = u.bounds.width;
+ var height = u.bounds.height;
+ var size = 2;
+ Pen.fillColor = Color.black.alpha_(sin(u.frame).abs/100);
+ Pen.fillRect(u.bounds);
+ Pen.strokeColor = Color(u.frame/1e3%1,sin(u.frame/100).abs,cos(u.frame/666).abs,0.1);
+ Pen.rotate(u.frame/(360/4), width/2, height/2);
+ Pen.scale(size, size);
+ Pen.use{
+ Pen.moveTo(Point(0,0));
+ 100.do{ |i| Pen.lineTo(Point(u.frame * cos(i) % 400, u.frame / sin(i) % 400)) };
+ Pen.stroke;
+ };
+};
+
+)
+GUI.qt
+
+
+
+o = Server.local.options;
+{CombC.ar(Mix(SinOsc.ar((1..20)*6.12))* SinOsc.ar([SinOsc.ar(15.4,0,20),SinOsc.ar(1.9,0,37)])* SinOsc.ar([500,400]),1,0.01,10)*0.01}.play
+
+
+
+{CombC.ar(Mix(SinOsc.ar((1..20)*145.12))* SinOsc.ar([SinOsc.ar(0.14,0,40),SinOsc.ar(0.19,0,37)])* SinOsc.ar([0.023,0.012]),1,0.1,10)*0.09}.play
+
+
+
+{(CombC.ar([Mix(SinOsc.ar((40..50)*7.23,(1..10)/10)),Mix(SinOsc.ar((40..50)*6.41,(1..10)/10))],10,SinOsc.ar(0.0001,0,10),2)*0.02)}.play
+
+s.quit
+s.boot
+
+
+(
+////////////////////////////////////////////////////////////////
+// EPIC SAX GUY SynthDefs
+// http://www.youtube.com/watch?v=KHy7DGLTt8g
+// Not yet there... but hearable
+
+// sounds more like a trumpet/horn after the failure and cheesyness of the stk sax
+SynthDef(\sax, { |out, freq=440, amp=0.1, gate=1|
+ var num = 16;
+ var harms = Array.series(num, 1, 1) * Array.exprand(num, 0.995, 1.001);
+ var snd = SinOsc.ar(freq * SinOsc.kr(Rand(2.0,5.0),0,Rand(0.001, 0.01),1) * harms, mul:Array.geom(num, 1, 0.63));
+ snd = Splay.ar(snd);
+ snd = BBandPass.ar(snd, freq * XLine.kr(0.1,4,0.01), 2);
+ snd = snd * amp * EnvGen.ar(Env.adsr(0.001, 0.2, 0.7, 0.2), gate, doneAction:2);
+ Out.ar(out, snd!2);
+}).add;
+
+// should be more like a gated synth, but this one gives the rhythmic element
+// remember to pass the bps from the language tempo!
+SynthDef(\lead, { |out, freq=440, amp=0.1, gate=1, bps=2|
+ var snd;
+ var seq = Demand.kr(Impulse.kr(bps*4), 0, Dseq(freq*[1,3,2], inf)).lag(0.01);
+ snd = LFSaw.ar(freq*{rrand(0.995, 1.005)}!4);
+ snd = Splay.ar(snd);
+ snd = MoogFF.ar(snd, seq, 0.5);
+ snd = snd * EnvGen.ar(Env.asr(0.01,1,0.01), gate, doneAction:2);
+ OffsetOut.ar(out, snd * amp);
+}).add;
+
+// yep, an organ with a sub bass tone :D
+SynthDef(\organ, { |out, freq=440, amp=0.1, gate=1|
+ var snd;
+ snd = Splay.ar(SinOsc.ar(freq*Array.geom(4,1,2), mul:1/4));
+ snd = snd + SinOsc.ar(freq/2, mul:0.4)!2;
+ snd = snd * EnvGen.ar(Env.asr(0.001,1,0.01), gate, doneAction:2);
+ OffsetOut.ar(out, snd * amp);
+}).add;
+
+// from the synth def pool
+SynthDef(\kick, { |out=0, amp=0.1, pan=0|
+ var env0, env1, env1m, son;
+
+ env0 = EnvGen.ar(Env.new([0.5, 1, 0.5, 0], [0.005, 0.06, 0.26], [-4, -2, -4]), doneAction:2);
+ env1 = EnvGen.ar(Env.new([110, 59, 29], [0.005, 0.29], [-4, -5]));
+ env1m = env1.midicps;
+
+ son = LFPulse.ar(env1m, 0, 0.5, 1, -0.5);
+ son = son + WhiteNoise.ar(1);
+ son = LPF.ar(son, env1m*1.5, env0);
+ son = son + SinOsc.ar(env1m, 0.5, env0);
+
+ son = son * 1.2;
+ son = son.clip2(1);
+
+ OffsetOut.ar(out, Pan2.ar(son * amp));
+}).add;
+
+// full of fail:
+
+//SynthDef(\sax, { |out, freq=440, amp=0.1, gate=1|
+// var r_stiff = 67;
+// var r_ap = 63;
+// var noise = 10;
+// var pos = 20;
+// var vibf = 20;
+// var vibg = 1;
+// var press = 85;
+// var snd = StkSaxofony.ar(freq, r_stiff, r_ap, noise, pos, vibf, vibg, press, 1, amp);
+// snd = snd * EnvGen.ar(Env.adsr(0.001, 0.2, 0.7, 0.2), gate, doneAction:2);
+// Out.ar(out, snd!2);
+//}).add;
+
+
+)
+
+////////////////////////////////////////////////////////////////
+// EPIC SAX GUY TUNE
+// http://www.youtube.com/watch?v=KHy7DGLTt8g
+// ... still needs a nice gated pad
+
+(
+TempoClock.default.tempo = 2.1;
+
+Pdef(\kick).quant = 4;
+Pdef(\organ).quant = 4;
+Pdef(\sax).quant = 4;
+Pdef(\lead).quant = 4;
+
+////////////////////////////////////////////////////////////////
+Pdef(\kick, Pbind(\instrument, \kick, \dur, 1, \amp, 1)).play;
+
+Pdef(\organ, Pbind(
+ \instrument, \organ,
+ \octave, [3,4],
+ \root, 3,
+ \scale, Scale.minor,
+ \degree, Pstutter(3, Pseq([0,-2,2,4], inf)),
+ \amp, 0.3,
+ \dur, Pseq([1.5,1.5,1], inf)
+)).play;
+
+Pdef(\lead, Pbind(
+ \instrument, \lead,
+ \octave, [5,6],
+ \root, 3,
+ \scale, Scale.minor,
+ \degree, Pseq([0,2,0,4], inf),
+ \amp, 0.2,
+ \bps, TempoClock.default.tempo,
+ \dur, 4
+)).play;
+
+// needs more articulation...
+Pdef(\sax, Pbind(
+ \instrument, \sax,
+ \root, 3,
+ \scale, Scale.minor,
+ \octave, 5,
+ \legato, 0.75,
+ \amp, Pwhite(0.9,1.0, inf),
+ \degree, Pseq([Pseq([Pn(4,4),3,4],2), Pseq([4,6,4,3,2,0,0,1,2,0])], inf),
+ \dur, Pseq([Pseq([2,1/2,Pn(1/4,3),3/4],2), Pseq([1.5,1,1,1,1,Pn(0.5,5)])], inf)
+)).play;
+)
+
+
+
+
+(
+fork{
+
+ // notes sequence
+
+ var seq = Pxrand([0,3,5,7,8],inf).asStream;
+
+ loop{
+
+ var dur = 8;
+
+ var num = 8;
+
+ var root = 36;
+
+ var freq = (seq.next+root).midicps;
+
+ var spread = rrand(0.4,0.8);
+
+ var attack = rrand(0.05, 0.3);
+
+
+
+ // play the cluster
+
+ play{
+
+ var harm = Array.geom(num, 1, 1.5);
+
+ var harma = Array.geom(num, 0.5, 0.8);
+
+ var detune = Array.fill(num, { LFNoise2.kr(1,0.01,1) });
+
+ var source = PinkNoise.ar;
+
+ var bandwidth = Rand(0.001,0.01);
+
+ var generator = [
+
+ SinOsc.ar(freq*harm*detune, mul:harma*0.3).scramble,
+
+ Resonz.ar(source, freq*harm*detune, bandwidth, mul:harma).scramble * 50
+
+ ].wchoose([0.2,0.8]);
+
+ var snd = Splay.ar(generator,spread);
+
+ snd * LFGauss.ar(dur, attack, loop:0, doneAction:2);
+
+ };
+
+ dur.wait;
+
+ };
+
+
+
+};
+)
+(
+
+
+
+// global triple super gverb
+
+{
+
+ var in = In.ar(0,2);
+
+ in = (in*0.2) + GVerb.ar(in, 220, 12, mul:0.6);
+
+ in = (in*0.2) + GVerb.ar(in, 220, 12, mul:0.6);
+
+ in = (in*0.2) + GVerb.ar(in, 220, 12, mul:0.6);
+
+ ReplaceOut.ar(0, Limiter.ar(LeakDC.ar(in)))
+
+}.play(addAction:\addToTail)
+)
+
+
+
+(
+Ndef(\plop, {
+ arg freq = 300;
+ var ou, sig1;
+ ou = SinOsc.ar(2 * EnvGen.kr(Env([1,100,4],[0.1,4])));
+ sig1 = ou;
+ ou = SinOsc.ar(300 + (ou * XLine.kr(1,125,4)));
+ ou = ou * SinOsc.ar(XLine.kr(1,45,4));
+ ou = CombL.ar(ou, 4, 1, XLine.kr(4,0.1,4));
+ ou = BPF.ar(ou, freq * Array.series(10,1,0.10), 0.1).sum;
+ ou = BPF.ar(ou, freq * Array.series(10,1,0.10) - 50, 0.7).sum;
+ ou = LPF.ar(ou, sig1.range(50, freq));
+ ou = ou !2;
+
+}).play
+)
+(
+Ndef(\plop, {
+ arg freq = 300;
+ var ou, sig1, sig2;
+ sig1 = SinOsc.ar(1.4).range(0.1,10);
+ sig2 = SinOsc.ar(0.4);
+ ou = LFSaw.ar(freq * ((Array.series(10, -0.5, 0.01) * SinOsc.kr(sig1,add:1.01)) + 1));
+ //ou = ou / 4;
+ //ou = BPF.ar(ou, freq * Array.series(3,1,0.10) - 50, 0.1).sum;
+ ou = BPF.ar(ou, freq, 0.7).sum;
+ //ou = Slew.ar(ou, 1000,100);
+ //ou = LPF.ar(ou, sig2.range(100,freq));
+ //ou = HPF.ar(ou, 400);
+ ou = ou + DelayL.kr(ou, 0.11,0.01 * sig2.abs + 0.001);
+ ou = ou.clip;
+ //ou = ou * 4;
+ ou = ou !2;
+
+}).play
+)
+
+
+s.boot
+
+
+{ SinOsc.ar }.play
+
+
+(
+
+Ndef(\ro_v19, {
+
+ var freq = 40.rrand(90).debug('base freq');
+
+ var seed = thisThread.randSeed = 1000000000.rand.debug('seed');
+
+ var sig = Splay.ar({
+
+ var i = 4.exprand(40).asInteger;
+
+ Median.ar(
+
+ 3.exprand(18),
+
+ EnvGen.ar(
+
+ Env( // wave form
+
+ [0] ++ Array.fill(i-1, {
+
+ [LFNoise2,LFNoise0,SinOsc,LFPulse,LFSaw].choose.kr(0.1.exprand(10), mul: 0.1.rrand(1))
+
+ }) ++ [0],
+
+ Array.rand(i-1, 0.1,1.0).normalizeSum,
+
+ [[-5.0.rrand(5),\sin].choose] ++ Array.fill(i-2, {
+
+ [\sin ! 1.rrand(6), -5.0.rrand(5) ! 1.rrand(4)].flat.choose
+
+ }) ++ [[-5.0.rrand(5),\sin].choose]
+
+ ).circle,
+
+ timeScale: Duty.kr( // freq
+
+ Drand([4,8,16,24], inf), 0,
+
+ Dwrand([1,2,4,8,16,32,64]*freq, ((14..7) ** 1.rrand(3)).normalizeSum, inf) // octave
+
+ * 0.5.coin.if({ Duty.kr( // note
+
+ [Dxrand, Drand].choose.new([0.125,0.25,0.5,1,2,4,6,8,12], inf), 0,
+
+ Dshuf({ (0..11).choose.midiratio } ! 1.exprand(8), inf)
+
+ ) }, { (0..11).choose.midiratio })
+
+ ).reciprocal
+
+ )
+
+ ) * EnvGen.kr( // rhythm
+
+ Env.perc(
+
+ 0.01.exprand(0.4) * 0.25.coin.if({ Duty.kr( // atk
+
+ Drand([0.5,1,2,4,8,12,16], inf), 0,
+
+ Dshuf({ [1,2,3,4].choose } ! 1.exprand(8), inf)
+
+ ) }, { 1 }),
+
+ 0.1.exprand(4) * 0.75.coin.if({ Duty.kr( // release
+
+ Drand([0.5,1,2,4,8,12,16], inf), 0,
+
+ Dshuf({ [1,2,4,8,16].choose.reciprocal } ! 1.exprand(8), inf)
+
+ ) }, { 1 }),
+
+ LFNoise2.kr(0.1.exprand(10)).range(0.05,1), // appearance
+
+ LFNoise2.kr(0.1.exprand(10)).range(-4,4),
+
+ ).circle
+
+ );
+
+ } ! 3.rrand(9).debug('source'));
+
+ BHiShelf.ar(
+
+ GVerb.ar(
+
+ Rotate2.ar(sig[0], sig[1], Duty.kr(Drand([2,4,8],inf), 0, Drand([-1,1,0],inf)) * LFSaw.kr(0.1.exprand(1))),
+
+ 10.rrand(150).debug('room')
+
+ ),
+
+ LFNoise2.kr(0.1.exprand(0.5)).range(4000,6500),
+
+ LFNoise2.kr(0.1.exprand(1)).range(1,3),
+
+ LFNoise2.kr(0.1.exprand(1)).range(-24,-16)
+
+ ) * 3;
+
+}).play
+
+)
+
+s.boot
+
+
+
+//additive synthesis bell
+//port of the pure-data example: D07.additive.pd
+(
+s.waitForBoot{
+ SynthDef(\risset2, {|out= 0, pan= 0, freq= 400, amp= 0.1, dur= 2, t_trig= 1|
+ var amps= #[1, 0.67, 1, 1.8, 2.67, 1.67, 1.46, 1.33, 1.33, 1, 1.33];
+ var durs= #[1, 0.9, 0.65, 0.55, 0.325, 0.35, 0.25, 0.2, 0.15, 0.1, 0.075];
+ var frqs= #[0.56, 0.56, 0.92, 0.92, 1.19, 1.7, 2, 2.74, 3, 3.76, 4.07];
+ var dets= #[0, 1, 0, 1.7, 0, 0, 0, 0, 0, 0, 0];
+ var src= Mix.fill(11, {|i|
+ var env= EnvGen.ar(Env.perc(0.005, dur*durs[i], amps[i], -4.5), t_trig);
+ SinOsc.ar(freq*frqs[i]+dets[i], 0, amp*env);
+ });
+ DetectSilence.ar(src, doneAction:2);
+ Out.ar(out, Pan2.ar(src, pan));
+ }).add;
+};
+)
+
+a= Synth(\risset2, [\freq, 72.midicps, \dur, 4])
+a.set(\t_trig, 1)
+a.set(\freq, 100.midicps, \dur, 3, \t_trig, 1)
+a.set(\freq, 60.midicps, \dur, 1, \t_trig, 1)
+a.set(\freq, 90.midicps, \dur, 0.5, \t_trig, 1)
+a.free
+
+(
+Routine({
+ var a= Synth(\risset2);
+ 20.do{
+ var dur= 0.2.exprand(3.0);
+ var fre= 60.0.exprand(5000.0);
+ ("dur:"+dur+"fre:"+fre).postln;
+ a.set(\t_trig, 1, \freq, fre, \dur, dur);
+ dur.wait;
+ };
+ a.free;
+ "done".postln;
+}).play;
+)
+
+
+(
+Mdef(\bla, Pbind(
+ \instrument, \risset2,
+ \freq, 60,
+ \dur, 0.5,
+))
+)
View
72 eventscore.sc
@@ -228,6 +228,19 @@
};
+~concat_notescores = { arg ns1, ns2;
+ var shift = ns1.abs_end;
+ var res = ns1.deepCopy;
+ var newno;
+ ns2.get_abs_notes.collect { arg no;
+ newno = no.deepCopy;
+ newno.time = newno.time + shift;
+ res.notes = res.notes.add(newno);
+ };
+ res.abs_end = shift + ns2.abs_end;
+ res;
+};
+
~make_notescore = {
(
@@ -288,7 +301,7 @@
no;
},
- get_rel_notes: { arg self, start=0, dur;
+ get_rel_notes: { arg self, start=0, dur=nil;
var notes, last, end;
start = self.abs_start + start;
end = if(dur.isNil) {
@@ -322,6 +335,10 @@
notes;
},
+ cut_exceeding_notes: { arg self, start=0, dur=nil;
+ self.notes = self.get_abs_notes(start, dur);
+ },
+
split_in_slices: { arg self, dur;
var total_dur = self.abs_end - self.abs_start;
var numslices = (total_dur / dur).asInteger;
@@ -338,9 +355,28 @@
};
},
- get_abs_notes: { arg self;
- // TODO
- self.notes;
+ filter_by_slot: { arg self, slotnum;
+ var res = self.deepCopy;
+ //[slotnum, res.notes].debug("filter_by_slot: before");
+ res.notes = res.notes.select { arg no;
+ no.slotnum == slotnum
+ };
+ //res.notes.debug("filter_by_slot: after");
+ res;
+ },
+
+ get_abs_notes: { arg self, start=0, dur=nil;
+ var notes, last, end;
+ start = self.abs_start + start;
+ end = if(dur.isNil) {
+ self.abs_end;
+ } {
+ start + dur;
+ };
+ notes = self.notes.select { arg no;
+ no.time >= start and: { no.time <= end }
+ };
+ notes;
}
)
};
@@ -353,7 +389,7 @@
update_notes: { arg self;
self.notes = self.notescore.get_rel_notes(self.slice_start, self.slice_dur);
- self.notes.debug("make_notescore.update_notes:notes");
+ //self.notes.debug("make_notescore.update_notes:notes");
},
set_notescore: { arg self, ns;
@@ -425,9 +461,15 @@
// quantify notes
notes.collect({arg no, x; no.numero = x }); // debug purpose
- notes.debug("update_note_dur: original notes");
- qnotes = notes.collect{ arg x; self.quantify_note(x) };
- qnotes.debug("update_note_dur: qnotes");
+ //notes.debug("update_note_dur: original notes");
+ qnotes = notes.collect{ arg x;
+ x = self.quantify_note(x);
+ if(x.midinote.isNil) {
+ x.midinote = x.slotnum;
+ };
+ x;
+ };
+ //qnotes.debug("update_note_dur: qnotes");
// troncate too long end silence
normdur = self.total_dur(notes);
@@ -462,11 +504,11 @@
}
};
- vnotes.debug("update_note_dur: vnotes");
+ //vnotes.debug("update_note_dur: vnotes");
self.notes = vnotes;
param.changed(\notes);
- param.debug("UPDATED NOTES !!!!");
+ //param.debug("UPDATED NOTES !!!!");
},
quantify_note: { arg self, note;
@@ -502,6 +544,10 @@
self.update_notes;
},
+ get_notescore: { arg self;
+ self.notescore;
+ },
+
set_next_notes: { arg self, val, dur=nil;
if(self.pat_finish_first.notNil) {
@@ -542,13 +588,13 @@
backward_in_history: { arg self;
self.history_index = (self.history_index + 1).clip(0, self.history.size);
self.set_next_notescore(self.history[self.history_index]);
- self.history[self.history_index].debug("backward_in_history: notescore");
+ //self.history[self.history_index].debug("backward_in_history: notescore");
},
forward_in_history: { arg self;
self.history_index = (self.history_index - 1).clip(0, self.history.size);
self.set_next_notescore(self.history[self.history_index]);
- self.history[self.history_index].debug("forward_in_history: notescore");
+ //self.history[self.history_index].debug("forward_in_history: notescore");
},
set_next_notescore_history: { arg self, val, dur=nil;
@@ -935,7 +981,7 @@
set_notequant: { arg self, val;
self.notequant = val;
- self.update_note_dur;
+ self.update_notes;
}
)
View
15 keycode.sc
@@ -900,20 +900,25 @@
side: [
["decrease_select_offset", \midi, 0, \begin],
["increase_select_offset", \midi, 0, \end],
+ ["increase_samplekit_part", \midi, 0, \right],
+ ["decrease_samplekit_part", \midi, 0, \left],
- ["play_group", \midi, \hold, \play],
- ["stop_group", \midi, \hold, \stop],
+ ["midi.play_group", \midi, \hold, \play],
+ ["midi.stop_group", \midi, \hold, \stop],
+ ["play_group", \kb, \ctrl, \f5],
+ ["stop_group", \kb, \ctrl, \f6],
["play_selected", \kb, 0, \f5],
["midi.play_selected", \midi, 0, \play],
["stop_selected", \kb, 0, \f6],
+ ["stop_selected_quant", \kb, \ctrlshift, \f6],
["midi.stop_selected", \midi, 0, \stop],
//["mute_selected", \kb, 0, \f7],
//["unmute_selected", \kb, \ctrl, \f7],
["solo_selected", \kb, 0, \f7],
["unsolo_selected", \kb, \ctrl, \f7],
["toggle_solo_selected", \midi, 0, \pause],
["panic", \kb, 0, \f8],
- ["edit_tempo", \kb, \ctrlalt, "r"], // t open terminal
+ ["edit_tempo", \kb, \ctrlalt, "e"], // t open terminal
["edit_quant", \kb, \ctrlalt, "q"],
["edit_barrecord", \kb, \ctrlalt, "b"],
["edit_selected_param", \kb, 0, \enter],
@@ -993,10 +998,14 @@
var realmod;
var key = binding[3];
var mod = binding[2];
+ var kind = binding[1];
if(~keycode.midi_mod.includes(mod)) {
mod
} {
case
+ { kind == \midi } {
+ realmod = 0;
+ }
{ ~keycode.kbarrow.keys.includes(key) } {
realmod = (
0: \arrow
View
64 live10.sc
@@ -36,17 +36,46 @@ s.waitForBoot{
-
Mdef.side_gui;
}
)
+(
+Mdef("pulsepass_l1035", Pbind(
+ \octave, 5
+
+))
+)
+~seq.save_project("belleinconnue")
+~seq.load_project("belleinconnue")
+~seq.load_project("pasla1")
+~seq.load_project("saveme2")
+
+~seq.save_project("testsaveme2")
+~seq.load_project("testsaveme2")
+
+~nn = Mdef.node("monosampler_l1011")
+~nn2 = Mdef.node("monosampler_l1002")
+~nn2.get_arg(\sampleline)
+
+~data = ~nn.get_arg(\sampleline).save_data
+~nn2.get_arg(\sampleline).load_data(~data)
+
+~nn.
+
+~nn = Mdef.node("pulsepass_l1035")
+~nn.get_arg(\sampleline).scoreset.notescore.notes.printAll
+~nn.get_arg(\sampleline).scoreset.notescore.notes.pop
+~nn.get_arg(\sampleline).scoreset.notescore.cut_exceeding_notes;
+Mdef.node("monosampler_l1027").get_arg(\sampleline).scoreset.notescore.abs_end
+Mdef.node("monosampler_l1027").get_arg(\sampleline).scoreset.notescore.get_rel_notes.printAll
+Mdef.node("monosampler_l1027").get_arg(\sampleline).scoreset.update_notes
+Mdef.node("monosampler_l1027").get_arg(\sampleline).scoreset.get_notes.printAll
+
+Mdef.node(\snare).get_arg(\freq).vpiano.value
~seq.get_node("pulsepass_l1001").get_arg(\noteline).scoreset.get_notes
-Mdef(\bleu, Pbind(
- \instrument, \mysnare
-));
Mdef(\froid, Pbind(
\instrument, \lead2
));
@@ -76,6 +105,33 @@ Mdef(\mygroup, Ppar([
)
+(
+
+Mdef(\snare, Pbind(
+ \instrument, \mysnare
+));
+Mdef(\kick, Pbind(
+ \instrument, \mykick2
+));
+Mdef.sampler(\smp, [
+ [\nsample, \kick],
+ [\nsample, \snare]
+ [\nsample, "monosampler_l1063"]
+]);
+)
+
+~seq.node_manager.add_node_to_default_group(~seq.get_node(\smp))
+~a = ~make_nodesampler.(~seq)
+~a = ~make_parplayer.(~seq)
+~a.name = "plop"
+~a.uname = ~a.name
+~seq.add_node(~a)
+~seq.node_manager.add_node_to_default_group(~a)
+
+~seq.node_manager.default_group.add_children(~a.name)
+
+~a.name = "plop"
+
{SinOsc.ar}.play
View
2 live11.sc
@@ -29,7 +29,7 @@ Pbind(\freq, 100, \degree, 0, \noise, Pfunc({ arg ev;
)
-
+s.meter
(
Pdef(\plopi,
View
134 live12.sc
@@ -0,0 +1,134 @@
+
+(
+s.waitForBoot{
+~seq = Mdef.force_init;
+~synthlib = [
+ \audiotrack_expander,
+ \lead2,
+ \pulsepass,
+ \flute1,
+ \miaou1,
+ \ringbpf1,
+ \piano2,
+ \pmosc,
+ \monosampler,
+ \stereosampler,
+ \ss_comb,
+ \ss_combfreq,
+].collect({ arg i; i -> i });
+
+~effectlib = [
+ \echo
+].collect({arg i; i -> i });
+
+~samplelib = [
+ "sounds/perc1.wav",
+ "sounds/pok1.wav",
+ "sounds/amen-break.wav",
+ "sounds/default.wav"
+];
+~seq.load_patlib( ~synthlib );
+~seq.load_effectlib( ~effectlib );
+~seq.set_presetlib_path("mypresets2");
+~seq.append_samplelib_from_path("sounds/" );
+~seq.append_samplelib_from_path("sounds/hydrogen/GMkit" );
+~seq.append_samplelib_from_path("sounds/hydrogen/HardElectro1" );
+
+
+
+Mdef.side_gui;
+}
+)
+~seq.play_manager.reset_state
+(
+Mdef(\plopi, Pbind(
+ \instrument, \monosampler,
+ \slotnum, Pseq([21,25,24,20],inf),
+ //\degree, Pseq([0,2,4,8],inf),
+ \sustain, 0.01,
+ \stepline, Pn(Plazy { Pseq([1,0.6,0.2,1].collect { arg i; if(i.coin) { 1 } { 0 } }) },10),
+ //\stepline, Pwalk([1,1,1,1,0,1,0,1,1,0,0], Pseq([1,1,1,2,1,2,1],inf), Pseq([1,1,-1],inf)),
+ \speed, Pwalk(Array.series(20,0.1,0.1), Pseq([-4,1,1,8],inf), Pseq([1,-1],inf)),
+ //\stepline, Pseq([1,1,0,1],inf),
+ //\dur, Pseq([0.5,[1,1,1,1]].convertRhythm,inf),
+ //\dur, Pseq([1,-1],inf),
+ \dur, 1/8,
+ \amp, 0.1
+));
+)
+
+(
+SynthDef(\beam, { arg out=0, amp=0.1, gate=1, pan=0, freq=200, sustain=1, mix=0.5, rq=0.5, mix_rlpf=0.5, fmidx= 0.8;
+ var ou, ou2;
+ var time = sustain;
+ var env, env2, env3;
+ var ouwrap, oufold, ouclip;
+ //ou = VarSaw.ar(freq*2, width: XLine.ar(0.5,1,time)).range(0,XLine.ar(1,1/1000,time))*40;
+ env = EnvGen.ar(Env([420,700,1000],[0.4,1.3]),gate);
+ env2 = EnvGen.ar(Env([1,1/1000],[0.21],0,1),gate);
+ env3 = EnvGen.ar(Env([1,1/1000,1],[0.101,0.101],0),gate);
+ fmidx = env3;
+ env = SinOsc.ar(freq*[1,7.450,4,1/2,1/4])*freq*fmidx+freq;
+ ou = VarSaw.ar(env, width: XLine.ar(0.5,1,time)).sum.range(0,env2);
+ ouwrap = SinOsc.ar(freq).wrap(-1*ou,ou);
+ oufold = SinOsc.ar(freq).fold(-1*ou,ou);
+ ouclip = SinOsc.ar(freq).clip(-1*ou,ou);
+ ou = ouwrap - ouclip;
+ ou = ouclip;
+ ou = ouwrap;
+ ou = oufold;
+ ou = (oufold - ouclip / ouwrap).softclip;
+ ou = ouclip - (oufold*2)+(1-ouwrap);
+ ou = SelectX.ar(mix*3, [ou, ouwrap, oufold, ouclip]);
+ ou2 = RLPF.ar(ou, freq*[1,2,4,1/2,1/4], rq).sum;
+ ou = SelectX.ar(mix_rlpf, [ou, ou2]);
+ //ou = SinOsc.ar(ou*(0.9*freq)+freq);
+ ou = ou * EnvGen.ar(Env.adsr(0.01,0.1,0.8,0.1),gate,doneAction:2);
+ ou = Pan2.ar(ou, pan, amp);
+ Out.ar(out, ou);
+}).add;
+)
+GUI.swing
+(
+Pdef(\beami, Pbind(
+ \instrument, \beam,
+ \degree, Pseq([0,2,4,3,5,7],inf),
+ //\freq, (40-12).midicps,
+ //\freq, 200,
+ \dur, 0.25*4,
+ \fmidx, 0.1,
+ \mix_rlpf, 1.5,
+ \rq, 4.1,
+ \mix, 0.7,
+ \amp, 1.1
+)).play;
+)
+
+(
+{
+
+var time = 8;
+
+var freq = (40-12).midicps;
+
+var a = VarSaw.ar(freq/2, width: XLine.ar(0.5,1,time)).range(0,XLine.ar(1,1/1000,time));
+
+var tone = SinOsc.ar(freq).fold(-1*a,a);
+
+Out.ar(0, tone.dup);
+
+}.play;
+
+)
+
+(
+Mdef(\perc, Pbind(
+ \instrument, \monosampler,
+ \reapeat, 0,
+ \sustain, 0.005,
+ //\legato, 0.01,
+ \slotnum, Pseq([0,7,2,7],inf),
+ \dur, Pseq([1,[1,1,1,1]].convertRhythm,inf),
+ \amp, 0.7
+));
+)
View
558 live13.sc
@@ -0,0 +1,558 @@
+s.meter
+(
+s.waitForBoot{
+~seq = Mdef.force_init(true);
+~synthlib = [
+ \audiotrack_expander,
+ \lead2,
+ \pulsepass,
+ \flute1,
+ \miaou1,
+ \ringbpf1,
+ \piano2,
+ \pmosc,
+ \monosampler,
+ \stereosampler,
+ \ss_comb,
+ \ss_combfreq,
+].collect({ arg i; i -> i });
+
+~effectlib = [
+ \echo
+].collect({arg i; i -> i });
+
+~samplelib = [
+ "sounds/perc1.wav",
+ "sounds/pok1.wav",
+ "sounds/amen-break.wav",
+ "sounds/default.wav"
+];
+~seq.load_patlib( ~synthlib );
+~seq.load_effectlib( ~effectlib );
+~seq.set_presetlib_path("mypresets2");
+~seq.append_samplelib_from_path("sounds/" );
+~seq.append_samplelib_from_path("sounds/hydrogen/GMkit" );
+~seq.append_samplelib_from_path("sounds/hydrogen/HardElectro1" );
+
+
+~tf = Pfunc({ arg ev; if(ev[\stepline] == 1) { \note } { \rest } });
+~ff = Pfunc({ arg ev; if(ev[\stepline1] == 1) { 100 } { \rest } });
+//Debug.enableDebug = false;
+
+Mdef.side_gui;
+}
+)
+
+Mdef.main.save_project("merdier");
+Mdef.main.load_project("merdier");
+Debug.enableDebug = true;
+Debug.enableDebug = false;
+[2,4,6,1].collect { arg deg; deg.postln; Scale.major.degreeToFreq(deg, 60.midicps, 1)}
+[2,4,7,1].collect { arg deg; deg.postln;}
+
+(
+Mdef.env(\mytest, Pbind(
+ \instrument, \default,
+ \freq, Ref(Env([700,200,300,400],[1,0.5,1],0)),
+ \amp, Ref(Env([0.1,1,0.1],[0.5,2],0)),
+ \dur, Pn(1,4)
+));
+)
+Scale.major.degreeToFreq(2, 60.midicps, 1);
+(
+Mdef.env(\merdier, Pbind(
+ \instrument, \lead2,
+ //\freq, Ref(Env([2,4,0,4].collect { arg deg; Scale.major.degreeToFreq(deg, 60.midicps, 1)},[1,0.5,1,1],4)),
+ \octave, 4,
+ \degree, Pseq([[0,2,4],[2,4,6]]),
+ //\degree, Ref(Env([7,2,3,4,1],[1,0.5,1,10],4)),
+ \rq, Ref(Env([0.1,1,0.1],[0.5,2],0)),
+ \wet, Ref(Env([0,1,0.5],[2,2,0.1,0.5],0)),
+ \mdetune, Ndef(\bla,{ SinOsc.kr(SinOsc.kr(1).range(0.5,5)).range(0.5,1.5) }),
+ \fbase, Ref(Env([1.7,1,3.4,4]*700,[0.5,0.2,1],0)),
+ \mylegato, 1,
+ \legato, 0.90,
+ \amp, 0.3,
+ \dur, Pn(4,2)
+));
+)
+Pdef(\merdier).stop
+Pn(Pdef(\mytest),inf).play
+
+
+Mdef.main.model.latency = 0
+
+(
+Mdef(\kick, Pbind(
+ \instrument, \kick2,
+ \release, Pseq([0.26,0.01,0.78,0.2],inf),
+ \amp, 0.5,
+ \stepline, Pseq([
+ 1,0,0,0, 1,0,0,0,
+ 1,0,1,0, 1,0,1,0,
+ 1,0,0,0, 1,0,0,0,
+ 1,1,0,1, 1,0,1,0,
+ ],inf),
+ \type, ~tf,
+ \fratio, Pseq([0.1,0.5,2,1.5],inf),
+ \dur, Pseq([0.1,0.1]*2.5/2,inf),
+));
+);
+
+(
+Mdef(\kick3, Pbind(
+ \instrument, \kick2,
+ \release, 0.2,
+ \amp, 0.1,
+ \stepline1, Pseq([
+ 1,0,1,0, 1,0,1,0,
+ ],inf),
+ //\freq, ~ff,
+ \fratio, 1.1,
+ \dur, Pseq([0.1,0.1]*2.5/2,inf),
+));
+);
+s.queryAllNodes
+(
+Mdef(\mymy, Ppar([
+ Pdef(\kick3)
+]))
+);
+
+(
+Mdef(\snare2, Pbind(
+ \instrument, \kraftySnr,
+ \freq, Pseq([2000,3000,4000,2000]*2,inf),
+ \decay, Pseq([0.26,0.07,0.18,0.2],inf),
+ \amp, 1.5,
+ \stepline, Pseq([
+ 0,0,1,0, 0,0,1,1,
+ 1,0,1,0, 0,0,1,0,
+ 1,1,1,0, 1,0,1,1,
+ 1,0,1,0, 1,1,0,1,
+ ],inf),
+ \type, ~tf,
+ \rq, Pseq([0.7,1.5,2,1.5],inf),
+ \dur, Pseq([0.1,0.1]*2.5/2,inf),
+));
+);
+
+(
+Mdef(\sax2, Pbind(
+ \instrument, \sax,
+ \root, 0,
+ \octave, [3,2],
+ \rq, Pseq([1.8,2],inf),
+ \degree, Pseq([0,2], inf),
+ \mylegato, 1,
+ \hdelta, 1.05,
+ \legato, 0.7,
+ \amp, 0.2,
+ \dur, 4.0
+));
+);
+(
+Mdef(\organ, Pbind(
+ \instrument, \organ,
+ \root, 0,
+ \octave, [5,4],
+ \rq, Pseq([1.8,2],inf),
+ \degree, Pseq([Pseq([0,1,5,4],2), Pseq([2,3,7,4],2)], inf).stutter(2),
+ \stepline, Pseq([
+ 1,
+ 1,1,0,1, 0,1,1,1
+ ],inf),
+ \mylegato, 1,
+ \hdelta, 1.05,
+ \legato, 0.7,
+ \repeat, 2,
+ \amp, 0.2,
+ \dur, 1.0/4
+));
+);
+(
+Mdef(\lead, Pbind(
+ \instrument, \lead,
+ \root, 0,
+ \octave, 5,
+ \rq, Pseq([1.8,2],inf),
+ \repeat, 0,
+ \degree, Pseq([0,2], inf),
+ \mylegato, 1,
+ \hdelta, 1.05,
+ \legato, 1,
+ \amp, 0.2,
+ \dur, 4
+));
+);
+
+(
+Mdef(\perc, Ppar([
+ Pdef(\kick),
+ Pdef(\snare2),
+]))
+
+);
+
+(
+Mdef(\melo, Ppar([
+ Pdef(\lead),
+ Pdef(\organ),
+ Pdef(\sax2),
+]))
+
+);
+
+
+(
+SynthDef(\compressor, { arg out=0, amp=0.1, threshold=0.5, slopeBelow=1, slopeAbove=1, clampTime=0.01, relaxTime=0.1;
+ var ou;
+ ou = In.ar(0,2);
+ //ou = ou * 0.1;
+ ou = Compander.ar(ou, ou, threshold, slopeBelow, slopeAbove, clampTime, relaxTime);
+ ou = ou * amp;
+ //ou = [0,0];
+ ReplaceOut.ar(out, ou);
+
+}).add;
+)
+Quarks.gui
+(
+~comp = Synth.tail(s, \compressor);
+~comp.set(\threshold, 0.5);
+~comp.set(\slopeBelow, 1.0);
+~comp.set(\slopeAbove, 1/48);
+~comp.set(\clampTime, 0.002);
+~comp.set(\amp, 0.5);
+)
+
+(
+Mdef(\part1, Ppar([
+ Pdef(\perc),
+ Pdef(\melo),
+]))
+
+);
+
+Mdef.node(\par1).children.remove(\sax)
+Mdef.node(\par1).children
+a = [4,5];
+a.remove(4)
+a
+
+
+Object.enableDebug
+Debug
+
+
+Array.series(16, 1, 1) * Array.exprand(16, 0.995, 1.001);
+
+
+
+(
+SynthDef(\ctlPoint, { |outbus, value, time, curve|
+ var start = In.kr(outbus, 1);
+ ReplaceOut.kr(outbus, EnvGen.kr(Env([start, value], [time], curve), doneAction: 2));
+}).store;
+)
+
+~bus = Bus.control(s,1);
+~bus.set(100);
+(
+Pbind(
+ \instrument, \ctlPoint,
+ \outbus, ~bus,
+ \value, Pseq([1,2,3,4,2,1])*50,
+ \curve, 0,
+ \time, Pfunc({arg ev; ev[\dur] / TempoClock.default.tempo }),
+ \dur, 1,
+).play
+)
+
+a = Synth(\lead2, [\amp, 0.5, \freq, ~bus.asMap])
+
+
+Quarks.gui
+
+
+Pbind(
+ \type, \envnote,
+ \instrument, \lead2,
+ \freq, Pvenv(Pseq([2,1,4])),
+ \rq, Pvenv(Pseq([1,2])),
+ \dur, 1,
+
+)
+
+(
+Event.addEventType(\myNote, { |server|
+ "plop".postln;
+ ~type = \note;
+ ~play.value;
+});
+)
+
+(
+Pbind(
+ \type, \myNote,
+ \instrument, \lead2,
+ \freq, Pseq([1,2,5,4]*50,inf),
+ \dur, 1,
+ \finish, { "fini".postln }
+
+).play
+)
+
+~env = { arg in; in };
+
+
+a = Env([1,2,3],[5,4])
+a.dump
+
+(
+~pb = Pbind(
+ \instrument, \lead2,
+ \freq, 200,
+ \rq, 0.1,
+ \dur, 1
+)
+)
+
+(
+~my = {
+var res = List.new;
+~pb.patternpairs.pairsDo { arg key, val;
+ res.add(key); res.add(val)
+};
+Pbind(*res)
+}
+)
+~pb2 = ~my.(~pb);
+~pb2.play
+~pb.play
+~pb[\freq]
+
+Ref(Env([1,2,3],[5,4])).class == Ref
+
+
+(
+a = Pproto({
+ ~bus = (type: \controlBus).yield;
+ ~bus.dump;
+},
+ Ppar([
+ Pbind(*[
+ instrument: \default,
+ freq: Pfunc { arg ev; var bus = Bus.new(\control,ev[\bus][\out],1,s); bus.asMap },
+ dur: 1,
+ ])
+ ])
+);
+a.trace.play;
+)
+s.boot
+
+(
+a = Pfset({
+ ~bus = Bus.control(s,1);
+ ~bus.debug("bus created");
+ ~bus.set(300);
+},
+ Ppar([
+ Pbind(*[
+ instrument: \default,
+ freq: Pfunc { arg ev; ev[\bus].asMap },
+ dur: 1,
+ ])
+ ]),
+{
+ ~bus.debug("cleanup");
+ ~bus.free;
+}
+);
+a.trace.play;
+)
+
+(
+~pb = ~penvcontrol.(Pbind(
+ \instrument, \default,
+ \freq, Ref(Env([100,400,500],[1,0.5],0)),
+ \amp, Ref(Env([0.1,1,0.1],[2,2],0)),
+ \sustain, 1,
+ //\amp, 0.5,
+ \dur, Pn(1,2)
+));
+~pb2 = Ppar([
+ Pn(~pb,inf),
+ Pbind(
+ \freq, 800,
+ \sustain, 0.1,
+ \dur, 2,
+ )
+
+]);
+~pbc = ~pb2.trace.play
+)
+~pbc.stop
+
+thisThread.clock
+
+"ljk".debug
+(
+~penvcontrol = { arg pat;
+ var buskeydict = Dictionary.new;
+ var respat = List.new;
+ var ctlpatlist = List.new;
+ var makebusmap;
+
+ "pcontrol start".debug;
+ makebusmap = { arg key;
+ Pfunc { arg ev; [key, ev[key]].debug("pfunc"); ev[key].asMap }
+ };
+
+ pat.patternpairs.pairsDo { arg key,val;
+ var buskey;
+ var env;
+ var cbus;
+ var ctlpat;
+ if(val.class == Ref) {
+ buskey = "bus_" ++ key;
+ respat.add(key);
+ respat.add(makebusmap.(buskey));
+ env = val.value;
+ buskeydict[buskey] = env.levels[0];
+ cbus.set(env.levels[0]);
+ ctlpat = Pbind(
+ \instrument, \ctlPoint,
+ \value, Pseq(env.levels[1..],inf),
+ \time, Pseq(env.times,inf) / Pfunc({thisThread.clock.tempo}),
+ \mykey, buskey,
+ \group, Pfunc { arg ev; ev[\busgroup] },
+ \outbus, Pfunc { arg ev; buskey.debug("ctlpat!!"); ev[buskey].index },
+ \curve, env.curves,
+ \dur, Pseq(env.times,inf)
+ );
+ ctlpatlist.add(ctlpat);
+ } {
+ respat.add(key);
+ respat.add(val);
+ }
+ };
+
+ respat.debug("respat");
+
+ Pfset({
+ buskeydict.debug("penvcontrol init pfset");
+ buskeydict.keysValuesDo { arg key, val;
+ currentEnvironment[key] = Bus.control(s, 1);
+ currentEnvironment[key].set(val);
+ };
+ //if( currentEnvironment[\busgroup].isNil ) {
+ currentEnvironment[\busgroup] = Group.new;
+ //};
+ },
+ Pfpar([Pbind(*respat)] ++ ctlpatlist),
+ {
+ buskeydict.debug("penvcontrol cleanup pfset");
+ buskeydict.keysValuesDo { arg key, val;
+ currentEnvironment[key].free;
+ };
+ currentEnvironment[\busgroup].freeAll;
+ currentEnvironment[\busgroup].free;
+ //currentEnvironment[\busgroup] = nil;
+ }
+ )
+};
+)
+
+currentEnvironment
+(
+~pcontrol2 = { arg pat;
+ "plop".postln;
+ Pspawner({ |spawner|
+ var blist = List.new;
+ var respat = List.new;
+ var ctlpatlist = List.new;
+ var ctlpat;
+ var cbus;
+ var env;
+ var clock = TempoClock.default;
+ var str;
+
+ "pcontrol start".debug;
+
+ pat.patternpairs.pairsDo { arg key,val;
+ if(val.class == Ref) {
+ respat.add(key);
+ cbus = Bus.control(s,1);
+ blist.add(cbus);
+ respat.add(cbus.asMap);
+ env = val.value;
+ cbus.set(env.levels[0]);
+ ctlpat = Pbind(
+ \instrument, \ctlPoint,
+ \value, Pseq(env.levels[1..],inf),
+ \time, Pseq(env.times,inf) / Pfunc({clock.tempo}),
+ \outbus, cbus,
+ \curve, env.curves,
+ \dur, Pseq(env.times,inf)
+ );
+ ctlpatlist.add(ctlpat);
+ } {
+ respat.add(key);
+ respat.add(val);
+ }
+ };
+ respat.debug("respat");
+
+ str = CleanupStream(Pbind(*respat).asStream, {
+ "cleanup".debug;
+ //spawner.suspendAll;
+ blist.do(_.free);
+ });
+ spawner.par(str);
+ ctlpatlist.do { arg pat;
+ spawner.par(pat);
+ };
+ });
+};
+)
+
+(
+SynthDef(\ctlPoint, { |outbus, value, time, curve|
+ var start = In.kr(outbus, 1);
+ ReplaceOut.kr(outbus, EnvGen.kr(Env([start, value], [time], curve), doneAction: 2));
+}).add;
+)
+
+~busfreq = Bus.control(s);
+~busrq = Bus.control(s);
+(
+Ppar([
+ Pbind(
+ \instrument, \lead2,
+ \freq, ~busfreq.asMap,
+ \rq, ~busrq.asMap,
+ \amp, 0.5,
+ \dur, 1
+ ),
+ Pbind(
+ \instrument, \ctlPoint,
+ \outbus, ~busfreq,
+ \value, Pseq([100,200,300],inf),
+ \curve, 0,
+ \time, Pfunc({arg ev; ev[\dur] / TempoClock.default.tempo }),
+ \dur, Pseq([1,0.5],inf),
+ ),
+ Pbind(
+ \instrument, \ctlPoint,
+ \outbus, ~busrq,
+ \value, Pseq([1,2,3]/2,inf),
+ \curve, 0,
+ \time, Pfunc({arg ev; ev[\dur] / TempoClock.default.tempo }),
+ \dur, Pseq([5,4],inf),
+ ),
+]).play
+)
+
+
View
130 live14.sc
@@ -0,0 +1,130 @@
+
+s.meter
+(
+s.waitForBoot{
+~seq = Mdef.force_init(true);
+~synthlib = [
+ \audiotrack_expander,
+ \lead2,
+ \pulsepass,
+ \flute1,
+ \miaou1,
+ \ringbpf1,
+ \piano2,
+ \pmosc,
+ \monosampler,
+ \stereosampler,
+ \ss_comb,
+ \ss_combfreq,
+].collect({ arg i; i -> i });
+
+~effectlib = [
+ \echo
+].collect({arg i; i -> i });
+
+~samplelib = [
+ "sounds/perc1.wav",
+ "sounds/pok1.wav",
+ "sounds/amen-break.wav",
+ "sounds/default.wav"
+];
+~seq.load_patlib( ~synthlib );
+~seq.load_effectlib( ~effectlib );
+~seq.set_presetlib_path("mypresets2");
+~seq.append_samplelib_from_path("sounds/" );
+~seq.append_samplelib_from_path("sounds/hydrogen/GMkit" );
+~seq.append_samplelib_from_path("sounds/hydrogen/HardElectro1" );
+
+
+~tf = Pfunc({ arg ev; if(ev[\stepline] == 1) { \note } { \rest } });
+~ff = Pfunc({ arg ev; if(ev[\stepline1] == 1) { 100 } { \rest } });
+//Debug.enableDebug = false;
+
+Mdef.side_gui;
+}
+)
+
+
+(
+Mdef(\kick1, Pbind(
+ \instrument, \kick2,
+ \dur, 1,
+ \amp, 0.1
+));
+);
+
+(
+Mdef(\snare1, Pbind(
+ \instrument, \kraftySnr,
+ \dur, 1,
+));
+);
+
+(
+Mdef.sampler(\smp, [
+ [\nsample, \kick1],
+ [\nsample, \kick],
+ [\nsample, \snare],
+ [\nsample, \snare1],
+ [\nsample, "monosampler_l1063"]
+]);
+);
+
+
+
+(
+Mdef(\kick2, Pbind(
+ \instrument, \kick2,
+ \dur, 1,
+ \amp, 0.1
+));
+);
+
+
+(
+SynthDef(\awi, { arg out=0, amp=0.1, gate=1, pan=0, freq=200, imp_ratio=1, saw_ratio=1, fratio=0.01, rqscale=1, rqbias=0.1, ffratio=4, ffbias=1;
+ var ou, trig, adsr_imp, adsr_saw, adsr_rq, adsr_ff;
+ adsr_imp = EnvGen.kr(~make_adsr.(\adsr_imp, Env.adsr(0.41,0.2,0.15,0.01)),gate,levelScale:freq*imp_ratio);
+ adsr_saw = EnvGen.kr(~make_adsr.(\adsr_saw, Env.adsr(0.41,0.2,0.15,0.01)),gate,levelScale:freq*saw_ratio);
+ adsr_rq = EnvGen.kr(~make_adsr.(\adsr_rq, Env.adsr(0.41,0.2,0.15,0.01)),gate,levelScale:rqscale, levelBias:rqbias);
+ //adsr_ff = EnvGen.kr(~make_adsr.(\adsr_ff, Env.adsr(0.41,0.2,0.15,0.01)),gate);
+ trig = Impulse.ar(adsr_imp);
+ freq = LFSaw.ar(adsr_saw).range(freq*(1+fratio),freq*(1-fratio));
+ ou = GrainSin.ar(1, trig, 0.001,freq*[1,1.01]).sum;
+ //ou = BPF.ar(ou, adsr_ff*ffratio*freq+freq, adsr_rq);
+ //ou = BPF.ar(ou, ffratio*freq, adsr_rq);
+ ou = ou * EnvGen.ar(~make_adsr.(\adsr,Env.adsr(0.01,0.1,0.8,0.1)),gate,doneAction:2);
+ ou = Pan2.ar(ou, pan, amp);
+ Out.ar(out, ou);
+}).add;
+)
+
+(
+Pdef(\awi, Pbind(
+ \instrument, \awi,
+ \adsr_imp, Pseq([
+ [ Env.adsr(0.41,0.1,0.014,0.01) ],
+ //[ Env.adsr(0.41,0.2,0.15,0.01) ],
+ ],inf),
+ \fratio, 0.41,
+ \adsr_saw, Pseq([
+ [ Env.adsr(0.01,0.02,0.85,0.01,7.1) ],
+ //[ Env.adsr(0.01,0.2,0.15,0.01) ],
+ ],inf),
+ \adsr_rq, Pseq([
+ [ Env.adsr(0.41,0.2,0.05,0.01,7.1) ],
+ ],inf),
+ \ffratio, 0.4,
+ \rqbias, 0.01,
+ \imp_ratio, 40.5,
+ \saw_ratio, 10.5,
+ \degree, Pseq([0,2,4],inf),
+ \dur, 1,
+ \amp, 0.1
+)).play;
+);
+
+{ SinOsc.ar(XLine.ar(50,2000,10)) ! 2 }.play
+GUI.swing
+~sw = SW_Scope.new;
+~sw.window.front
View
8 live9.sc
@@ -55,7 +55,7 @@ SynthDef(\lead2, { arg out=0, freq = 100, pan=0, amp=0.1, mdetune=1.004, gate=1,
LocalOut.ar(fb * fbamp);
fb = Limiter.ar(fb, amp);
fb = SelectX.ar(wet, [ou, fb*fbpamp]);
- fb = fb * EnvGen.ar(Env.adsr(0.001,0.4,0.1,rt), gate, doneAction:2);
+ fb = fb * EnvGen.ar(Env.adsr(0.001,0.4,0.9,rt), gate, doneAction:2);
fb = Pan2.ar(fb, pan, amp);
Out.ar(out, fb);
}).store;
@@ -74,6 +74,12 @@ SynthDef(\record_input, { arg out = 0, bufnum = 0, sustain;
env = EnvGen.kr(Env.linen(0,sustain,0), doneAction:2); // stop recording after dur..
RecordBuf.ar(input, bufnum, doneAction: 0, run:env, loop: 0);
}).store;
+SynthDef(\record_input_mono, { arg out = 0, bufnum = 0, sustain;
+ var input, env;
+ input = SoundIn.ar([0,1]).sum;
+ env = EnvGen.kr(Env.linen(0,sustain,0), doneAction:2); // stop recording after dur..
+ RecordBuf.ar(input, bufnum, doneAction: 0, run:env, loop: 0);
+}).store;
SynthDef(\audiotrack, { arg out = 0, amp=0.20, bufnum = 0, sustain;
var playbuf, ou;
playbuf = PlayBuf.ar(2,bufnum,startPos:44100*0.046,doneAction:0);
View
208 main.sc
@@ -148,6 +148,24 @@
res;
};
+~save_archive_data = { arg self, list, data=nil;
+ data = data ?? Dictionary.new;
+ list.do { arg key;
+ if(self[key].notNil) {
+ data[key] = self[key]
+ }
+ };
+ data
+};
+
+~load_archive_data = { arg self, list, data;
+ list.do { arg key;
+ if(data[key].notNil) {
+ self[key] = data[key]
+ }
+ };
+};
+
// this function take a pattern and a list of Pmono pattern as effects
~pfx = { arg pat, effects;
Pspawner({ |spawner|
@@ -194,6 +212,80 @@
});
};
+~penvcontrol = { arg pat, chain=nil;
+ var buskeydict = Dictionary.new;
+ var respat = List.new;
+ var ctlpatlist = List.new;
+ var pbindpat;
+ var makebusmap;
+
+ "pcontrol start".debug;
+ makebusmap = { arg key;
+ Pfunc { arg ev; [key, ev[key]].debug("pfunc"); ev[key].asMap }
+ };
+
+ if(pat.class == EventPatternProxy) {
+ pbindpat = pat.source;
+ } {
+ pbindpat = pat
+ };
+
+ pbindpat.patternpairs.pairsDo { arg key,val;
+ var buskey;
+ var env;
+ var cbus;
+ var ctlpat;
+ if(val.class == Ref) {
+ buskey = "bus_" ++ key;
+ respat.add(key);
+ respat.add(makebusmap.(buskey));
+ env = val.value;
+ buskeydict[buskey] = env.levels[0];
+ cbus.set(env.levels[0]);
+ ctlpat = Pbind(
+ \instrument, \ctlPoint,
+ \value, Pseq(env.levels[1..],inf),
+ \time, Pseq(env.times,inf) / Pfunc({thisThread.clock.tempo}),
+ \group, Pkey(\busgroup),
+ \outbus, Pfunc { arg ev; ev[buskey].index },
+ \curve, env.curves,
+ \dur, Pseq(env.times,inf)
+ );
+ ctlpatlist.add(ctlpat);
+ }
+ };
+
+ respat.debug("respat");
+
+ Pfset({
+ buskeydict.debug("penvcontrol init pfset");
+ buskeydict.keysValuesDo { arg key, val;
+ currentEnvironment[key] = Bus.control(s, 1);
+ currentEnvironment[key].set(val);
+ };
+ currentEnvironment[\busgroup] = Group.new;
+ },
+ Pfpar(
+ [
+ if(chain.notNil) {
+ chain <> Pbind(*respat) <> pat;
+ } {
+ Pbind(*respat) <> pat;