rsc3/doc-schelp/HelpSource/Classes/Pser.schelp

40 lines
816 B
Text

class:: Pser
summary:: sequentially embed values in a list
related:: Classes/Pseq
categories:: Streams-Patterns-Events>Patterns>List
description::
is like link::Classes/Pseq::, however the repeats variable gives strong::the number of items:: returned instead of the number of complete cycles.
Examples::
code::
(
var a, b;
a = Pser([1, 2, 3], 5); // return 5 items
b = a.asStream;
6.do({ b.next.postln; });
)
//Pser used as a sequence of pitches:
(
SynthDef(\help_sinegrain,
{ arg out=0, freq=440, sustain=0.05;
var env;
env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction: Done.freeSelf);
Out.ar(out, SinOsc.ar(freq, 0, env))
}).add;
)
(
a = Pser([Pser(#[60, 61, 63, 65, 72], 3)], inf).asStream;
Routine({
loop({
Synth(\help_sinegrain, [\freq, a.next.midicps]);
0.2.wait;
})
}).play;
)
::