class library: SynthDef - lazy implementation of removeUGen
[supercollider.git] / HelpSource / Classes / Pgbrown.schelp
blob52ce6e15c62fff5c7e34b264983a14d2e9b2e48b
1 class:: Pgbrown
2 summary:: geometric brownian motion pattern
3 related:: Classes/BrownNoise, Classes/Pbrown
4 categories:: Streams-Patterns-Events>Patterns>Random
6 description::
8 Returns a stream that behaves like a geometric brownian motion.
10 ClassMethods::
12 method::new
14 argument::lo
15 lower boundary of values.
17 argument::hi
18 upper boundary of values.
20 argument::step
21 maximum multiplication factor per step (omega) - the distribution is xrand2.
23 argument::length
24 number of values produced.
26 Examples::
28 code::
30 var a, b;
31 a = Pgbrown(0.0, 1.0, 0.2, inf);
32 b = a.asStream;
33 7.do({ b.next.postln; });
37 // sound example
39 SynthDef(\help_sinegrain,
40         { arg out=0, freq=440, sustain=0.05;
41                 var env;
42                 env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction:2);
43                 Out.ar(out, SinOsc.ar(freq, 0, env))
44         }).add;
48 var a;
49 a = Pgbrown(1.0, 2.0, 0.1, inf).asStream;
50 Routine({
51         loop({
52         Synth(\help_sinegrain, [\freq, a.next * 600 + 300]);
53         0.02.wait;
54         })
55 }).play;
58 // compare with normal brownian motion:
61 var a;
62 a = Pbrown(1.0, 2.0, 0.1, inf).asStream;
63 Routine({
64         loop({
65                 Synth(\help_sinegrain, [\freq, a.next * 600 + 300]);
66                 0.02.wait;
67         })
68 }).play;