Merge pull request #506 from andrewcsmith/patch-2
[supercollider.git] / HelpSource / Classes / Pfindur.schelp
blob950f4362e41e459d24714b7ff84ff2edf2230358
1 class:: Pfindur
2 summary:: limit total duration of events embedded in a stream
3 related:: Classes/Pfinval, Classes/Pfin, Classes/Pconst
4 categories:: Streams-Patterns-Events>Patterns>Repetition
6 ClassMethods::
8 method::new
9 Embeds elements of the strong::pattern:: into the stream until the duration comes close enough to strong::dur::.
11 Examples::
13 code::
15 var a, b;
16 a = Pfindur(5, Pbind(\dur, Prand([1, 2, 0.5, 0.1], inf)));
17 x = a.asStream;
18 9.do({ x.next(Event.default).postln; });
22 //Pfindur used as a sequence of pitches
25 SynthDef(\help_sinegrain,
26         { arg out=0, freq=440, sustain=0.05;
27                 var env;
28                 env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction:2);
29                 Out.ar(out, SinOsc.ar(freq, 0, env))
30         }).add;
34 var c;
35 c = Pbind(
36         \dur, Prand([1, 0.02, 0.2], inf),
37         \instrument, \help_sinegrain,
38         \degree, Pseries(0, 1, inf),
39         \octave, 6
42 Pn(
43         Pfindur(1, c)
44 ).play;