class library: SynthDef - lazy implementation of removeUGen
[supercollider.git] / HelpSource / Classes / Ppatmod.schelp
blob65cfa60e51f3f4d6e5919df606f58bf133e36262
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::func
11 A link::Classes/Function:: that modifies the enclosed pattern and embeds it in the stream.
13 Examples::
15 code::
17 a = Ppatmod(
18         Pseq([0, 0, 0, 0],1),
19         { arg pat, i;
20                 var list;
21                 list = pat.list;
22                 pat.list = list.put(list.size.rand, 2);
23         }, inf);
25 x = a.asStream;
26 30.do({ x.next.postln });
30 //Ppatmod used to modify a pattern that produces a sequence of pitches:
33 SynthDef(\help_sinegrain,
34         { arg out=0, freq=440, sustain=0.05;
35                 var env;
36                 env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction:2);
37                 Out.ar(out, SinOsc.ar(freq, 0, env))
38         }).add;
42 a = Pn(
43         Ppatmod(
44                 Pseq([0, 0, 0, 0],1),
45                 { arg pat, i;
46                         var list;
47                         list = pat.list;
48                         pat.list = list.put(list.size.rand, 2);
49                 }, 15),
50 inf).asStream;
52 Routine({
53         loop({
54                 Synth(\help_sinegrain, [\freq, (a.next*5+77).midicps]);
55                 0.13.wait;
56         })
57 }).play;