2 summary:: Sets the synth's random generator seed.
3 related:: Classes/RandID
4 categories:: UGens>Generators>Stochastic, UGens>Random
9 When the trigger signal changes from nonpositive to positve, the synth's
10 random generator seed is reset to the given value. All synths that use
11 the same random number generator reproduce the same sequence of numbers
15 See link::Classes/RandID:: UGen for setting the randgen id and
16 link::Reference/randomSeed:: for the client side equivalent.
25 The trigger. Trigger can be any signal. A trigger happens when
26 the signal changes from non-positive to positive.
36 // start a noise patch
40 var noise, filterfreq;
41 noise = WhiteNoise.ar(0.05 ! 2) + Dust2.ar(70 ! 2);
42 filterfreq = LFNoise1.kr(3, 5500, 6000);
43 Resonz.ar(noise * 5, filterfreq, 0.5) + (noise * 0.5)
47 // reset the seed at a variable rate
50 RandSeed.kr(Impulse.kr(MouseX.kr(0.1, 100)), seed);
61 // above you can see that the sound of the LFNoise1 is not exactly reproduced (filter frequency)
62 // this is due to interference between the internal phase of the noise ugen and the
65 // a solution is to start a new synth:
68 SynthDef("pseudorandom", { arg out, sustain=1, seed=1967, id=0;
69 var noise, filterfreq;
74 noise = WhiteNoise.ar(0.05 ! 2) + Dust2.ar(70 ! 2);
75 filterfreq = LFNoise1.kr(3, 5500, 6000);
78 Resonz.ar(noise * 5, filterfreq, 0.5) + (noise * 0.5)
80 Line.kr(1, 0, sustain, doneAction:2)
86 // the exact same sound is reproduced
90 Synth("pseudorandom");
91 1.1.wait; // wait a bit longer than sustain, so sounds don't overlap
96 // changing the rand seed changes the sound:
100 (1902..2005).do { |seed|
103 Synth("pseudorandom", [\seed, seed]);
113 (1902..2005).do { |seed|
116 Synth("pseudorandom", [\seed, seed, \sustain, 0.05]);
123 // if the sounds overlap, this does not work as expected anymore
129 Synth("pseudorandom");
130 0.8.wait; // instead of 1.1
135 // rand id can be used to restrict the resetting of the seed to each voice:
140 (1902..2005).do { |seed|
143 Synth("pseudorandom", [\seed, seed, \id, id]);
144 id = id + 1 % 16; // there is 16 different random generators