// title: Cookiemonster // author: bernhard // description: // Grainsynth Sampler based on the Example in the Documentation. I'd call it crumblesynthesis. "ME WANT COOKIE!!!" // code: /// Grainsynth Sampler based on the Example in the Documentation. I'd call it crumblesynthesis. /// CLOCK and DURATIOM randomized via LFNoise1, borders are set with mulclock, addclock, muldur and adddur. LFNoise1 folds to positiv with .abs, offset is added after. lfo1 and lfo2 are the speeds of LFNoise1. /// For more silent parts approach addclock to zero or make it negativ /// Env is randomized with PinkNoise /// MouseX is playbackrate, MouseY is position in buffer. Blured with PinkNoise, intensity via vrate and vpos /// Buffers can be switched on the fly with x.set(\buf... /// For Multichannel expansion get rid of Splay.ar and adapt !8 /// use mono cookies, "ME WANT COOKIE!!!" ( SynthDef(\cookiemonster, { arg gate = 1, lfo1 = 0.3, lfo2 = 0.7, vrate = 0.01, vpos = 0.003, mulclock = 64, addclock = 43, muldur = 1, adddur = 0.1, buf=0, amp = 0.1, out=0; var rate, pos, sig, trig, env, atk, rel, dur; trig=Impulse.kr(LFNoise1.kr(lfo1,mulclock).abs+addclock); dur=LFNoise1.kr(lfo2,muldur).abs+adddur; rate=MouseX.kr(0, 5)*PinkNoise.kr(vrate,1); pos=MouseY.kr(0,1)*PinkNoise.kr(vpos,1); atk=dur*PinkNoise.kr(0.9,0.5); rel=dur-atk; env=EnvGen.kr(Env([0, 1, 0], [atk, rel], \sin, 1), gate,1,doneAction: 2); sig={BufGrain.ar(trig,dur,buf,rate,pos,4,env)}!8; sig=Splay.ar(sig); sig=LeakDC.ar(sig*amp); Out.ar(out,sig.tanh); }).add; ) ( x=Synth( \cookiemonster, [\buf, Buffer.read(s,"/Path/to/my/cookiebox/cookie1.wav"), ]);) x.set(\out,0) x.set(\amp,0.1) x.set(\mulclock,12) x.set(\addclock,7) x.set(\lfo1,1.12) x.set(\vrate,0.4) x.set(\muldur,0.1) x.set(\adddur,0.05) x.set(\lfo2,0.24) x.set(\vpos,0.4) x.set(\buf, Buffer.read(s,"/Path/to/my/cookiebox/cookie2.wav")) x.set(\buf, Buffer.read(s,"/Path/to/my/cookiebox/cookie3.wav")) x.set(\buf, Buffer.read(s,"/Path/to/my/cookiebox/cookie4.wav")) x.set(\buf, Buffer.read(s,"/Path/to/my/cookiebox/cookie5.wav")) x.free