2 summary:: sequentially embed values in a list
4 categories:: Streams-Patterns-Events>Patterns>List
8 Cycles over a list of values. The repeats variable gives the number of times to repeat the entire list.
15 a = Pseq([1, 2, 3], 2); // repeat twice
17 7.do({ b.next.postln; });
21 Pseq also has an offset argument which gives a starting offset into the list.
25 a = Pseq([1, 2, 3, 4], 3, 2); // repeat 3, offset 2
27 13.do({ b.next.postln; });
31 You can pass a function for the repeats variable that gets evaluated when the stream is created.
35 a = Pseq([1, 2], { rrand(1, 3) }); // repeat 1,2, or 3 times
37 7.do({ b.next.postln; });
41 If you specify the value inf for the repeats variable, then it will repeat indefinitely.
45 a = Pseq([1, 2, 3], inf); // infinite repeat
47 10.do({ b.next.postln; });
52 Pseq used as a sequence of pitches:
55 SynthDef(\help_sinegrain,
56 { arg out=0, freq=440, sustain=0.05;
58 env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction:2);
59 Out.ar(out, SinOsc.ar(freq, 0, env))
64 a = Pseq(#[60, 61, 63, 65, 72], inf).asStream;
67 Synth(\help_sinegrain, [\freq, a.next.midicps]);