linux: shared memory interface - link with librt
[supercollider.git] / HelpSource / Classes / Pnsym.schelp
blob5c5087653c4734b684ec56175cc445c8d32827c9
1 class:: Pnsym
2 summary:: use a pattern of symbols to embed Pdefns
3 categories:: Libraries>JITLib>Patterns
4 related:: Classes/Pdefn
6 description::
7 for event patterns see link::Classes/Psym::. Overview: link::Overviews/JITLib::.
9 ClassMethods::
11 method::new
13 argument::pattern
14 a pattern that returns symbols or characters. Arrays are converted to parallel patterns ( link::Classes/Ptuple:: ).
16 argument::dict
17 the dictionary to be used for lookup. By default, this is code::Pdefn.all::, so one can embed Pdefns by name.
19 InstanceMethods::
21 method::dict
22 set the dictionary to be used.
24 Examples::
26 code::
28 // load a synthdef
29 s.boot;
30 SynthDef("gpdef",
31         { arg out=0, freq=440, sustain=0.05, amp=0.1, pan;
32                 var env;
33                 env = EnvGen.kr(Env.perc(0.01, sustain), doneAction:2) * amp;
34                 Out.ar(out, Pan2.ar(SinOsc.ar(freq, 0, env), pan))
35         }).add;
38 Pdefn(\x, Pn(1, 3));
39 Pdefn(\y, Prand([5, 9, 1], 2));
40 Pdefn(\z, Pdefn(\y) * 2);
43 Pdef(\play,
44         Pbind(
45                 \instrument, \gpdef,
46                 \harmonic, Pnsym(Pseq([\x, \x, Prand([\x, \y]), [\z, \y], \y], inf)).trace,
47                 \dur, 0.2, \note, 10
48         )
49 ).play;
52 // change root pattern:
53 Pdefn(\x, Pn(2, 3));
54 Pdefn(\x, Pseq([1, 3, 1, 2, 1, 4, 5]));
55 Pdefn(\x, Pseq([1, 3, 1, 2, [1, 3], 4, 5]));