linux: shared memory interface - link with librt
[supercollider.git] / HelpSource / Classes / Prout.schelp
blob83b8311abcf5876662b4805ebfcb684a13e97926
1 class:: Prout
2 summary:: routine pattern
3 related:: Classes/Proutine, Classes/Routine
4 categories:: Streams-Patterns-Events>Patterns>Function
6 description::
8 note that there is a shortcut to create a Prout:
10 code::p(func)::
12 ClassMethods::
14 method::new
15 Returns a routine from the function.
17 argument::func
18 routine function.
20 Examples::
22 code::
24 var a;
25 a = Prout({ loop { 1.yield; 2.yield; 7.yield; 10.do { 1.0.rand.yield } }});
26 a.asStream.nextN(100).plot;
30 // sound example
32 SynthDef(\help_sinegrain,
33         { arg out=0, freq=440, sustain=0.05;
34                 var env;
35                 env = EnvGen.kr(Env.perc(0.01, sustain, 0.1), doneAction:2);
36                 Out.ar(out, SinOsc.ar(freq, 0, env))
37         }).add;
42 var a;
43 a = Prout({ loop { 1.yield; 2.yield; 7.yield; 10.do { 1.0.rand.yield } }}).asStream;
45         a.do { |val|
46                 Synth(\help_sinegrain, [\freq, val * 100 + 300]);
47                 0.02.wait;
48         }
49 }.fork;
52 // shortcut:
54 Pbind(
55         \instrument, \help_sinegrain,
56         \freq, p { loop { ([1000, 2000].choose + [100, 200].choose + [10, 20].choose).postln.yield } },
57         \dur, 0.1
58 ).play;