bump version to -rc2
[supercollider.git] / Help / Streams-Patterns-Events / Patterns / Pfindur.html
blob1f31208c7e089d9e8ae95e09f37816ecf9e022eb
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta http-equiv="Content-Style-Type" content="text/css">
6 <title></title>
7 <meta name="Generator" content="Cocoa HTML Writer">
8 <meta name="CocoaVersion" content="1038.25">
9 <style type="text/css">
10 p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
11 p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
12 p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
13 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; min-height: 16.0px}
14 p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #007300}
15 p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
16 p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #0000bf}
17 span.s1 {font: 18.0px Helvetica}
18 span.s2 {color: #0000bf}
19 span.s3 {color: #007300}
20 span.s4 {color: #000000}
21 span.Apple-tab-span {white-space:pre}
22 </style>
23 </head>
24 <body>
25 <p class="p1"><span class="s1"><b>Pfindur</b></span> <span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>limit total duration of events embedded in a stream</b></p>
26 <p class="p2"><br></p>
27 <p class="p1"><b>superclass: FilterPattern</b></p>
28 <p class="p2"><br></p>
29 <p class="p1"><b>Pfindur(dur, pattern, tolerance)</b></p>
30 <p class="p2"><br></p>
31 <p class="p1">embeds elements of the <b>pattern</b> into the stream until the duration comes close enough to <b>dur</b>.</p>
32 <p class="p2"><br></p>
33 <p class="p2"><br></p>
34 <p class="p3">(</p>
35 <p class="p3"><span class="s2">var</span> a, b;</p>
36 <p class="p3">a = <span class="s2">Pfindur</span>(5, <span class="s2">Pbind</span>(<span class="s3">\dur</span>, <span class="s2">Prand</span>([1, 2, 0.5, 0.1], <span class="s2">inf</span>)));</p>
37 <p class="p3">x = a.asStream;</p>
38 <p class="p3">9.do({ x.next(<span class="s2">Event</span>.default).postln; });</p>
39 <p class="p3">)</p>
40 <p class="p2"><br></p>
41 <p class="p4"><br></p>
42 <p class="p1">Pfindur used as a sequence of pitches</p>
43 <p class="p4"><br></p>
44 <p class="p4"><br></p>
45 <p class="p3">(</p>
46 <p class="p5"><span class="s2">SynthDef</span><span class="s4">(</span>\help_sinegrain<span class="s4">,<span class="Apple-converted-space"> </span></span></p>
47 <p class="p3"><span class="Apple-tab-span"> </span>{ <span class="s2">arg</span> out=0, freq=440, sustain=0.05;</p>
48 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">var</span> env;</p>
49 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>env = <span class="s2">EnvGen</span>.kr(<span class="s2">Env</span>.perc(0.01, sustain, 0.2), doneAction:2);</p>
50 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">Out</span>.ar(out, <span class="s2">SinOsc</span>.ar(freq, 0, env))</p>
51 <p class="p3"><span class="Apple-tab-span"> </span>}).add;</p>
52 <p class="p3">)</p>
53 <p class="p6"><br></p>
54 <p class="p6"><br></p>
55 <p class="p6"><br></p>
56 <p class="p3">(</p>
57 <p class="p3"><span class="s2">var</span> c;</p>
58 <p class="p3">c = <span class="s2">Pbind</span>(</p>
59 <p class="p3"><span class="Apple-tab-span"> </span><span class="s3">\dur</span>, <span class="s2">Prand</span>([1, 0.02, 0.2], <span class="s2">inf</span>),</p>
60 <p class="p5"><span class="s4"><span class="Apple-tab-span"> </span></span>\instrument<span class="s4">, </span>\help_sinegrain<span class="s4">,</span></p>
61 <p class="p3"><span class="Apple-tab-span"> </span><span class="s3">\degree</span>, <span class="s2">Pseries</span>(0, 1, <span class="s2">inf</span>),</p>
62 <p class="p5"><span class="s4"><span class="Apple-tab-span"> </span></span>\octave<span class="s4">, 6</span></p>
63 <p class="p3">);</p>
64 <p class="p6"><br></p>
65 <p class="p7">Pn<span class="s4">(</span></p>
66 <p class="p3"><span class="Apple-tab-span"> </span><span class="s2">Pfindur</span>(1, c)</p>
67 <p class="p3">).play;</p>
68 <p class="p3">)</p>
69 <p class="p6"><br></p>
70 <p class="p6"><br></p>
71 <p class="p6"><br></p>
72 <p class="p6"><br></p>
73 <p class="p6"><br></p>
74 <p class="p6"><br></p>
75 </body>
76 </html>