Merge pull request #506 from andrewcsmith/patch-2
[supercollider.git] / HelpSource / Classes / Pstutter.schelp
blob10213be01b30e5826d4ee8820ec2366a54009e94
1 class:: Pstutter
2 summary:: repeat input stream values
3 related:: Classes/Pn
4 categories:: Streams-Patterns-Events>Patterns>Repetition
6 description::
8 repeat each element n times.
10 ClassMethods::
12 method::new
14 argument::n
15 may be a pattern, so the number of times can vary each iteration.
17 argument::pattern
18 the pattern
20 Examples::
22 code::
24 var a, b;
25 a = Pstutter(2, Pseq([1, 2, 3],inf));
26 x = a.asStream;
27 13.do({ x.next.postln; });
31 //Pstutter used as a sequence of pitches
34 SynthDef(\help_sinegrain,
35         { arg out=0, freq=440, sustain=0.05;
36                 var env;
37                 env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction:2);
38                 Out.ar(out, SinOsc.ar(freq, 0, env))
39         }).add;
44 c = Pstutter(3, Prand([1, 2, 3],inf)*4+65);
45 x = c.asStream;
46 Routine({
47         loop({
48                 Synth(\help_sinegrain, [\freq, x.next.midicps]);
49                 0.12.wait;
50         })
51 }).play;