2 // the old sc website example
3 This example comes from supercollider.sourceforge.net as of 2003. It uses a loop to generate 40 different variations on a SynthDef, and then a process to play them.
9 { arg i_bus = 0, amp = 0.1, rate = 1;
12 exc = // exitation signal
13 // .ar or .kr means it's a unit generator
16 Impulse.kr(0,0,amp*0.1),
19 out = Klank.ar(`[ // resonator
20 {exprand(100.0, 10000.0)}.dup(n),
21 { rrand(0.1,1.0) }.dup(n),
22 {exprand(0.05,1.0)}.dup(n)
24 DetectSilence.ar(out, 0.0001, 0.1, 2);
25 Out.ar( // output to bus number i_bus
27 Pan2.ar( out, rrand(-1.0,1.0))
29 }).send(s); // send synthdef to server
33 // a process to use them.
39 var dur=0.2, inst = \rperc0, amp = 0.05;
40 inf.do({ // do forever
41 // 30% chance of picking new synth
43 inst = "rperc" ++ 40.rand.asString;
44 amp = exprand(0.02,0.2) * 0.5;
46 // allocate new synth on server
48 \s_new, inst, -1, 0, 0,
57 }).play(TempoClock.default);