scide: implement selectionLength for openDocument
[supercollider.git] / HelpSource / Classes / Ppatmod.schelp
blob545b4fc2376dc2f9604b115f60f374a30995d6d6
1 class:: Ppatmod
2 summary:: modify a given pattern before passing it into the stream
3 related:: Classes/Plazy
4 categories:: Streams-Patterns-Events>Patterns>Filter
6 ClassMethods::
8 method::new
10 argument::pattern
11 the pattern.
13 argument::func
14 A link::Classes/Function:: that modifies the enclosed pattern and embeds it in the stream.
16 argument::repeats
17 the number of repeats.
19 Examples::
21 code::
23 a = Ppatmod(
24         Pseq([0, 0, 0, 0],1),
25         { arg pat, i;
26                 var list;
27                 list = pat.list;
28                 pat.list = list.put(list.size.rand, 2);
29         }, inf);
31 x = a.asStream;
32 30.do({ x.next.postln });
36 //Ppatmod used to modify a pattern that produces a sequence of pitches:
39 SynthDef(\help_sinegrain,
40         { arg out=0, freq=440, sustain=0.05;
41                 var env;
42                 env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction:2);
43                 Out.ar(out, SinOsc.ar(freq, 0, env))
44         }).add;
48 a = Pn(
49         Ppatmod(
50                 Pseq([0, 0, 0, 0],1),
51                 { arg pat, i;
52                         var list;
53                         list = pat.list;
54                         pat.list = list.put(list.size.rand, 2);
55                 }, 15),
56 inf).asStream;
58 Routine({
59         loop({
60                 Synth(\help_sinegrain, [\freq, (a.next*5+77).midicps]);
61                 0.13.wait;
62         })
63 }).play;