scel: install files to site-lisp/SuperCollider
[supercollider.git] / HelpSource / Classes / Pn.schelp
blob5fefd1a461fd8e95bf6d352863c595a972c78f58
1 class:: Pn
2 summary:: repeatedly embed a pattern
3 related:: Classes/Pstutter
4 categories:: Streams-Patterns-Events>Patterns>Repetition
6 ClassMethods::
8 method::new
10 argument::repeats
11 Repeats the enclosed pattern strong::repeats:: times.
13 argument::key
14 If strong::key:: is non-nil, it sets the value of that key to true whenever it restarts the pattern. This can be used to advance Patterns enclosed by link::Classes/Pgate::.
16 Examples::
18 code::
20 var a, b;
21 a = Pn(Pseq(#[1, 2, 3], 1), 4); // repeat pattern four times
22 b = a.asStream;
23 16.do({ b.next.postln; });
26 // sound example
28 SynthDef(\help_sinegrain,
29         { arg out=0, freq=440, sustain=0.05;
30                 var env;
31                 env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction:2);
32                 Out.ar(out, SinOsc.ar(freq, 0, env))
33         }).add;
37 var a;
38 a = Pn(Pshuf([1, 2, 2, 3, 3, 3], 4)).asStream;
40         loop {
41                 Synth(\help_sinegrain, [\freq, a.next * 600 + 300]);
42                 0.2.wait;
43         }
44 }.fork;