linux: shared memory interface - link with librt
[supercollider.git] / HelpSource / Classes / Plambda.schelp
blob93543e48392b915676085f02c5d77b55e144cd3b
1 class:: Plambda
2 summary:: create a scope (namespace) for enclosed streams
3 related:: Classes/Penvir, Classes/Pkey
4 categories:: Streams-Patterns-Events>Patterns>Data Sharing
6 ClassMethods::
8 method::new
10 argument::pattern
11 an event stream.
13 argument::scope
14 an event with default bindings (can be nil).
16 Examples::
18 code::
19 // Plet, Pget and Plambda.
20 // Plet(key, stream, return)
21 // Pget(key, default, repeats)
24 SynthDef(\sine,
25         { arg out=0, freq=440, sustain=0.05, pan=0, amp=0.1;
26                 var env;
27                 env = EnvGen.kr(Env.perc(Rand(0.001, 0.02), sustain, AmpCompA.kr(freq)*amp), doneAction:2);
28                 Out.ar(out, Pan2.ar(SinOsc.ar(freq), pan, env))
29         }).add;
33 a = Plambda(
34         Pseq([
35         Pfindur(5,
36                 Ppar([
37                         Pbind(\note, Plet(\x, Prand([1, 5, 1, [10, 14]], inf)), \dur, 8/3, \pan, -1),
38                         Pbind(\note, Plet(\y, Pseq([5, 3, 2, 0, [0, 5, 6, 9]], inf)), \dur, 0.5, \pan,1),
39                         Pbind(\note, Pseq([Pget(\x), Pget(\y)], inf) + 12, \pan, 0, \dur, 2/3)
40                 ])
41         ),
42         Pbind(\note, Pget(\x, 0, 6) + [0, 5], \dur, Pstutter(inf, Prand([2/3, 1/6])))
43         ], inf).trace(\eventScope) // internally, the values are shared via \eventScope
45 b = Pbindf(a, \instrument, \sine, \legato, 0.1);
46 b.play
49 // this structure remains parallelizable
51 Ppar([b, Pbindf(b, \ctranspose, 24, \dur, Pkey(\dur) * 0.25)]).play;