sclang: array primitives - respect mutability when changing object.
[supercollider.git] / examples / pieces / DrummerSynthDef.scd
blob84ad14609138a0fe1dad0c703eed57d5426ee636
2 // (thor magnusson) (2006)
4 // An instrumentalist inside a synthdef.
7 SynthDef(\drummer, { arg out=0, tempo=4;
8         var snare, base, hihat;
9         tempo = Impulse.ar(tempo); // for a drunk drummer replace Impulse with Dust !!!
11         snare =         WhiteNoise.ar(Decay2.ar(PulseDivider.ar(tempo, 4, 2), 0.005, 0.5));
12         base =  SinOsc.ar(Line.ar(120,60, 1), 0, Decay2.ar(PulseDivider.ar(tempo, 4, 0), 0.005, 0.5));
13         hihat =         HPF.ar(WhiteNoise.ar(1), 10000) * Decay2.ar(tempo, 0.005, 0.5);
14         
15         Out.ar(out,(snare + base + hihat) * 0.4 ! 2)
16 }).add;
19 a = Synth(\drummer);
20 a.set(\tempo, 6);
21 a.set(\tempo, 18);
22 a.set(\tempo, 180); // check the CPU! no increase.
23 a.free;