Forgot a help fix: Drag a dock's title bar, not divider, to reposition
[supercollider.git] / HelpSource / Classes / Plazy.schelp
blob8ee1b8fe92f5a0b88f8fc5d135aba0653a07fd31
1 class:: Plazy
2 summary:: instantiate new patterns from a function
3 related:: Classes/PlazyEnvir, Classes/PlazyEnvirN, Classes/Pfunc
4 categories:: Streams-Patterns-Events>Patterns>Function
6 description::
8 Plazy evaluates a function that returns a pattern and embeds it in a stream.
10 ClassMethods::
12 method::new
14 argument::func
15 A link::Classes/Function:: that returns a pattern or any other valid pattern input.
17 Examples::
19 code::
21 a = Plazy({
22         var x, y;
23         x = Array.series(rrand(2, 4), [1, 100].choose, 1);
24         Pshuf(x,1);
25 });
26 x = Pn(a, inf).asStream;
27 30.do({ x.next.postln });
31 //Plazy used to produce a sequence of pitches:
34 SynthDef(\help_sinegrain,
35         { arg out=0, freq=440, sustain=0.05;
36                 var env;
37                 env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction:2);
38                 Out.ar(out, SinOsc.ar(freq, 0, env))
39         }).add;
43 a = Plazy({
44         var x, y;
45         x = Array.series(rrand(2, 4), [1, 5].choose, 1);
46         x.put(x.size.rand, 8+0.1.rand2);
47         Pseq(x,1);
48 });
49 x = Pn(a, inf).asStream;
51 Routine({
52         loop({
53                 Synth(\help_sinegrain, [\freq, (x.next*5+70).midicps]);
54                 0.13.wait;
55         })
56 }).play;
60 // using event streams
63 a = Plazy({
64         var x, y;
65         x = Array.series(rrand(2, 4), [1, 5].choose, 1);
66         x.put(x.size.rand, 8+0.1.rand2);
67         Pbind(
68                 \instrument, \help_sinegrain,
69                 \dur, 0.12,
70                 \degree, Pseq(x, 2)
71         )
72 });
74 Pn(a, inf).play;