polymorphism: better names for .binaryValue and .booleanValue are .asInteger and...
[supercollider.git] / Help / Libraries / JITLib / Patterns / EventPatternProxy.html
blobe3548ffa7c3804b3e4b9f5d92430685e0e703054
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="949.43">
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: 9.0px Monaco; min-height: 12.0px}
12 p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
13 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
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; color: #bf0000}
16 p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #0000bf}
17 p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000; min-height: 12.0px}
18 span.s1 {font: 18.0px Helvetica}
19 span.s2 {font: 9.0px Monaco}
20 span.s3 {color: #0000bf}
21 span.s4 {color: #0000bf}
22 span.s5 {color: #606060}
23 span.s6 {color: #000000}
24 span.s7 {color: #007300}
25 span.Apple-tab-span {white-space:pre}
26 </style>
27 </head>
28 <body>
29 <p class="p1"><span class="s1"><b>EventPatternProxy<span class="Apple-tab-span"> </span></b></span><span class="s2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span><b>event stream reference</b></p>
30 <p class="p2"><br></p>
31 <p class="p1">superclass: TaskProxy</p>
32 <p class="p3"><br></p>
33 <p class="p3"><br></p>
34 <p class="p3"><br></p>
35 <p class="p1">keeps a reference to a stream that can be replaced while playing.</p>
36 <p class="p1">Multiple streams are thus handled without creating dependancies.</p>
37 <p class="p3"><br></p>
38 <p class="p1">related: <a href="Pdef.html"><span class="s3">Pdef</span></a></p>
39 <p class="p3"><br></p>
40 <p class="p3"><br></p>
41 <p class="p1"><b><span class="Apple-tab-span"> </span>*new(source)</b></p>
42 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>create a new instance with a pattern (the source).</p>
43 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>the pattern should be an <i>event pattern</i> (see <b>Pdef</b>)</p>
44 <p class="p3"><br></p>
45 <p class="p1"><span class="Apple-tab-span"> </span><b>*default</b></p>
46 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>a default source, if none is given. the default is a Pbind with resting notes of 1.0 beat duration</p>
47 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
48 <p class="p1"><b><span class="Apple-tab-span"> </span>source_(obj)</b></p>
49 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>set the source (a pattern). If a quantization is given, schedule this change to the next beat</p>
50 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>(<b>pattern_</b>(..) is equivalent)</p>
51 <p class="p3"><span class="Apple-tab-span"> </span></p>
52 <p class="p1"><span class="Apple-tab-span"> </span><b>clear</b><span class="Apple-tab-span"> </span>set the source to nil</p>
53 <p class="p3"><span class="Apple-tab-span"> </span></p>
54 <p class="p1"><b><span class="Apple-tab-span"> </span>quant_(beats)</b></p>
55 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>set the quantization value. can be an array<span class="Apple-converted-space">  </span>[quant, phase, offset, outset]</p>
56 <p class="p3"><span class="Apple-tab-span"> </span></p>
57 <p class="p1"><b><span class="Apple-tab-span"> </span>quant</b></p>
58 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>get the quantization value</p>
59 <p class="p3"><span class="Apple-tab-span"> </span></p>
60 <p class="p1"><b><span class="Apple-tab-span"> </span>*defaultQuant_(beats)</b></p>
61 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>set the default quantization value for the class. (default: 1.0)</p>
62 <p class="p3"><br></p>
63 <p class="p3"><span class="Apple-tab-span"> </span></p>
64 <p class="p1"><span class="Apple-tab-span"> </span><b>fadeTime_(beats)</b></p>
65 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>when the synthdefs that are used contain an \amp control, the patterns are replaced</p>
66 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>by crossfading the previous with the new over this time (in beats)</p>
67 <p class="p3"><span class="Apple-tab-span"> </span></p>
68 <p class="p1"><span class="Apple-tab-span"> </span><b>envir_(event)</b></p>
69 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>provide a default event for the Pdef. It is used to filter the incoming stream before it</p>
70 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>is<span class="Apple-converted-space">  </span>passed to the source pattern.<span class="Apple-converted-space">  </span>This is similar to NodeProxy-nodeMap.</p>
71 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>When set for the first time, the pattern is rebuilt.</p>
72 <p class="p3"><span class="Apple-tab-span"> </span></p>
73 <p class="p1"><span class="Apple-tab-span"> </span><b>set(key, val, key2, val2, ...)</b></p>
74 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>set arguments in the default event. If there is none, it is created and the pattern is rebuilt.</p>
75 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
76 <p class="p3"><br></p>
77 <p class="p3"><br></p>
78 <p class="p3"><br></p>
79 <p class="p1"><b><i>a) using as stream reference</i></b></p>
80 <p class="p3"><span class="Apple-tab-span"> </span></p>
81 <p class="p3"><br></p>
82 <p class="p1"><span class="Apple-tab-span"> </span><b>asStream</b></p>
83 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>returns an instance of RefStream, which updates its stream as soon as the pattern</p>
84 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>is changed.</p>
85 <p class="p3"><span class="Apple-tab-span"> </span></p>
86 <p class="p1"><span class="Apple-tab-span"> </span><b>embedInStream(inval)</b></p>
87 <p class="p1"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>just like any pattern, embeds itself in stream</p>
88 <p class="p3"><span class="Apple-tab-span"> </span></p>
89 <p class="p3"><span class="Apple-tab-span"> </span></p>
90 <p class="p3"><span class="Apple-tab-span"> </span></p>
91 <p class="p3"><span class="Apple-tab-span"> </span></p>
92 <p class="p1"><b><i>b) using as EventStreamPlayer</i></b></p>
93 <p class="p3"><br></p>
94 <p class="p3"><br></p>
95 <p class="p1"><span class="Apple-tab-span"> </span><b>play(clock, protoEvent, quant)</b></p>
96 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>starts the EventPatternProxy and creates a player.<span class="Apple-converted-space"> </span></p>
97 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>if you want to play multiple instances, use <b>.fork(clock, quant, protoEvent)</b></p>
98 <p class="p1"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>quant </b>can be an array of [quant, phase, offset, outset]</p>
99 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
100 <p class="p1"><span class="Apple-tab-span"> </span><b>stop</b></p>
101 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>stops the player</p>
102 <p class="p3"><span class="Apple-tab-span"> </span></p>
103 <p class="p1"><span class="Apple-tab-span"> </span><b>player</b><span class="Apple-tab-span"> </span></p>
104 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>the current player (if the Pdef is simply used in other streams this is nil)</p>
105 <p class="p3"><br></p>
106 <p class="p1"><span class="Apple-tab-span"> </span><b>pause / resume / reset / mute / unmute</b></p>
107 <p class="p1"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>perform player method<span class="Apple-converted-space"> </span></p>
108 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
109 <p class="p1"><span class="Apple-tab-span"> </span><b>isPlaying</b><span class="Apple-converted-space"> </span></p>
110 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>returns true if Pdef is running.</p>
111 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>if a Pdef is playing and its stream ends, it will schedule a stream for playing<span class="Apple-converted-space"> </span></p>
112 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>as soon as a new one is assigned to it.</p>
113 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
114 <p class="p3"><span class="Apple-tab-span"> </span></p>
115 <p class="p3"><br></p>
116 <p class="p3"><br></p>
117 <p class="p3"><br></p>
118 <p class="p3"><br></p>
119 <p class="p1"><b><i>a) embedding EventPatternProxy in streams:</i></b></p>
120 <p class="p3"><br></p>
121 <p class="p2"><br></p>
122 <p class="p2"><br></p>
123 <p class="p4">(</p>
124 <p class="p4"><span class="s4">SynthDef</span>(<span class="s5">"Pdefhelp"</span>, { <span class="s4">arg</span> out, freq, sustain=1, amp=1, pan;</p>
125 <p class="p4"><span class="Apple-tab-span"> </span><span class="s4">var</span> env, u=1;</p>
126 <p class="p4"><span class="Apple-tab-span"> </span>env = <span class="s4">EnvGen</span>.kr(<span class="s4">Env</span>.perc(0.03, sustain), 1, doneAction:2);</p>
127 <p class="p4"><span class="Apple-tab-span"> </span>5.do { <span class="s4">var</span> d; d = exprand(0.01, 1); u = <span class="s4">SinOsc</span>.ar(d * 300, u, rrand(0.1,1.2) * d, 1) };</p>
128 <p class="p4"><span class="Apple-tab-span"> </span><span class="s4">Out</span>.ar(out, <span class="s4">Pan2</span>.ar(<span class="s4">SinOsc</span>.ar(u + 1 * freq, 0, amp * env), pan));</p>
129 <p class="p2"><br></p>
130 <p class="p4">}).store;</p>
131 <p class="p4">)</p>
132 <p class="p4">s.boot;</p>
133 <p class="p2"><br></p>
134 <p class="p4">#a, b, c, m = { <span class="s4">EventPatternProxy</span>.new } ! 4;</p>
135 <p class="p2"><br></p>
136 <p class="p4">m.play;</p>
137 <p class="p5"><span class="s6">m.source = </span><span class="s4">Pbind</span><span class="s6">(</span>\instrument<span class="s6">, </span>\Pdefhelp<span class="s6">, </span>\dur<span class="s6">, 1, </span>\degree<span class="s6">, 16, </span>\legato<span class="s6">, 0.1);</span></p>
138 <p class="p2"><br></p>
139 <p class="p4">a.source = <span class="s4">Pbind</span>(<span class="s7">\instrument</span>, <span class="s7">\Pdefhelp</span>, <span class="s7">\dur</span>, 0.25, <span class="s7">\degree</span>, <span class="s4">Pseq</span>(#[0, 5, 4, 3]));</p>
140 <p class="p4">b.source = <span class="s4">Pbind</span>(<span class="s7">\instrument</span>, <span class="s7">\Pdefhelp</span>, <span class="s7">\dur</span>, 0.125, <span class="s7">\degree</span>, <span class="s4">Pseq</span>(#[7, 8, 7, 8]));</p>
141 <p class="p4">c.source = <span class="s4">Pbind</span>(<span class="s7">\instrument</span>, <span class="s7">\Pdefhelp</span>, <span class="s7">\dur</span>, 0.25, <span class="s7">\degree</span>, <span class="s4">Pseq</span>(#[0, 1, 2], 2));</p>
142 <p class="p2"><br></p>
143 <p class="p4">x = <span class="s4">Pseq</span>([a, b, c], <span class="s4">inf</span>).play;</p>
144 <p class="p2"><br></p>
145 <p class="p2"><br></p>
146 <p class="p4">c.source = <span class="s4">Pbind</span>(<span class="s7">\instrument</span>, <span class="s7">\Pdefhelp</span>, <span class="s7">\dur</span>, 0.25, <span class="s7">\degree</span>, <span class="s4">Pseq</span>(#[4, 3, 1, 2]*3));</p>
147 <p class="p2"><br></p>
148 <p class="p2"><br></p>
149 <p class="p6">// infinite loops are scheduled (to ths clock's next beat by default) and released:</p>
150 <p class="p2"><br></p>
151 <p class="p4">a.source = <span class="s4">Pbind</span>(<span class="s7">\instrument</span>, <span class="s7">\Pdefhelp</span>, <span class="s7">\dur</span>, 0.753, <span class="s7">\degree</span>, <span class="s4">Pseq</span>(#[0, 5, 4, 3, 2], <span class="s4">inf</span>));</p>
152 <p class="p4">a.source = <span class="s4">Pbind</span>(<span class="s7">\instrument</span>, <span class="s7">\Pdefhelp</span>, <span class="s7">\dur</span>, 0.125, <span class="s7">\degree</span>, <span class="s4">Pseq</span>(#[0, 5, 4, 3] + 1, 1));</p>
153 <p class="p4">a.source = <span class="s4">Pbind</span>(<span class="s7">\instrument</span>, <span class="s7">\Pdefhelp</span>, <span class="s7">\dur</span>, 0.25, <span class="s7">\degree</span>, <span class="s4">Pseq</span>(#[0, 5, 4, 3] - 1, 1));</p>
154 <p class="p2"><br></p>
155 <p class="p4">a.source = <span class="s4">Pbind</span>(<span class="s7">\instrument</span>, <span class="s7">\Pdefhelp</span>, <span class="s7">\dur</span>, 0.125, <span class="s7">\degree</span>, <span class="s4">Pseq</span>(#[0, 5] - 1, 1));</p>
156 <p class="p4">a.source = <span class="s4">Pbind</span>(<span class="s7">\instrument</span>, <span class="s7">\Pdefhelp</span>, <span class="s7">\dur</span>, 0.753, <span class="s7">\degree</span>, <span class="s4">Pshuf</span>(#[0, 5, 4, 3, 2], <span class="s4">inf</span>));</p>
157 <p class="p2"><br></p>
158 <p class="p4">x.stop;</p>
159 <p class="p4">m.stop;</p>
160 <p class="p2"><br></p>
161 <p class="p6">// EventPatternProxy can be used in multiple patterns</p>
162 <p class="p2"><br></p>
163 <p class="p4">(</p>
164 <p class="p4">x = <span class="s4">Ppar</span>([</p>
165 <p class="p7"><span class="s6"><span class="Apple-tab-span"> </span></span>Pbindf<span class="s6">(</span>Pn<span class="s6">(a, </span>inf<span class="s6">),</span></p>
166 <p class="p4"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s7">\gtranspose</span>, <span class="s4">Pstutter</span>(8, <span class="s4">Pseq</span>(#[0, 2, 0, 3],<span class="s4">inf</span>))</p>
167 <p class="p4"><span class="Apple-tab-span"> </span>),</p>
168 <p class="p7"><span class="s6"><span class="Apple-tab-span"> </span></span>Pbindf<span class="s6">(</span>Pn<span class="s6">(a, </span>inf<span class="s6">),</span></p>
169 <p class="p4"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s7">\gtranspose</span>, <span class="s4">Pstutter</span>(8, <span class="s4">Pseq</span>(#[7, 4, 0, 3],<span class="s4">inf</span>)),<span class="Apple-converted-space"> </span></p>
170 <p class="p4"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s7">\dur</span>, 0.6</p>
171 <p class="p4"><span class="Apple-tab-span"> </span>),</p>
172 <p class="p7"><span class="s6"><span class="Apple-tab-span"> </span></span>Pbindf<span class="s6">(</span>Pn<span class="s6">(a, </span>inf<span class="s6">),</span></p>
173 <p class="p4"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s7">\degree</span>, <span class="s4">Pseq</span>(#[0, 5, 4, 3, 2, 3, 2], 1)</p>
174 <p class="p4"><span class="Apple-tab-span"> </span>)</p>
175 <p class="p4">]).play;</p>
176 <p class="p4">)</p>
177 <p class="p2"><br></p>
178 <p class="p4">a.source = <span class="s4">Pbind</span>(<span class="s7">\instrument</span>, <span class="s7">\Pdefhelp</span>, <span class="s7">\dur</span>, 0.1, <span class="s7">\degree</span>, <span class="s4">Pseq</span>(#[0, 1, 0, 1, 2], <span class="s4">inf</span>));</p>
179 <p class="p2"><br></p>
180 <p class="p4">a.source = <span class="s4">Pbind</span>(<span class="s7">\instrument</span>, <span class="s7">\Pdefhelp</span>, <span class="s7">\dur</span>, 0.2, <span class="s7">\degree</span>, <span class="s4">Pseq</span>([0, 4], <span class="s4">inf</span>));</p>
181 <p class="p2"><br></p>
182 <p class="p4">a.source = <span class="s4">Pbind</span>(<span class="s7">\instrument</span>, <span class="s7">\Pdefhelp</span>, <span class="s7">\dur</span>, 0.2, <span class="s7">\degree</span>, <span class="s4">Pseq</span>([0, 4, <span class="s4">Prand</span>([6, 8b],2)], <span class="s4">inf</span>));</p>
183 <p class="p2"><br></p>
184 <p class="p4">a.source = <span class="s4">Pbind</span>(<span class="s7">\instrument</span>, <span class="s7">\Pdefhelp</span>, <span class="s7">\dur</span>, 0.1, <span class="s7">\degree</span>, <span class="s4">Pseq</span>(#[0, 1b, 1, 2b, 2, 3, 4b, 4, 5], <span class="s4">inf</span>));</p>
185 <p class="p2"><br></p>
186 <p class="p6"><span class="s6">a.set(</span><span class="s7">\detune</span><span class="s6">, -50); </span>// set environment</p>
187 <p class="p4">a.set(<span class="s7">\detune</span>, 0);</p>
188 <p class="p2"><br></p>
189 <p class="p4">x.stop;</p>
190 <p class="p2"><br></p>
191 <p class="p8"><br></p>
192 <p class="p8"><br></p>
193 <p class="p8"><br></p>
194 <p class="p1"><b><i>b) playing EventPatternProxy</i></b></p>
195 <p class="p8"><br></p>
196 <p class="p2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
197 <p class="p4">(</p>
198 <p class="p6">// load a synthdef</p>
199 <p class="p4">s.boot;</p>
200 <p class="p7">SynthDef<span class="s6">(</span><span class="s5">"gpdef"</span><span class="s6">,<span class="Apple-converted-space"> </span></span></p>
201 <p class="p4"><span class="Apple-tab-span"> </span>{ <span class="s4">arg</span> out=0, freq=440, sustain=0.05, amp=0.1, pan;</p>
202 <p class="p4"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s4">var</span> env;</p>
203 <p class="p4"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>env = <span class="s4">EnvGen</span>.kr(<span class="s4">Env</span>.perc(0.01, sustain), doneAction:2) * amp;</p>
204 <p class="p4"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s4">Out</span>.ar(out, Pan2.ar(<span class="s4">SinOsc</span>.ar(freq, 0, env), pan))</p>
205 <p class="p4"><span class="Apple-tab-span"> </span>}).store;</p>
206 <p class="p4">)</p>
207 <p class="p2"><br></p>
208 <p class="p2"><br></p>
209 <p class="p4">#x, y = {<span class="s4">EventPatternProxy</span>.new} ! 2;</p>
210 <p class="p2"><br></p>
211 <p class="p6"><span class="s6">x.play; </span>// play them. A silent resting pattern is used.</p>
212 <p class="p4">y.play;<span class="Apple-converted-space"> </span></p>
213 <p class="p2"><br></p>
214 <p class="p2"><br></p>
215 <p class="p6">// assign various patterns to it:</p>
216 <p class="p2"><br></p>
217 <p class="p4">x.source = <span class="s4">Pbind</span>(<span class="s7">\dur</span>, 0.25, <span class="s7">\instrument</span>, <span class="s7">\gpdef</span>);<span class="Apple-converted-space"> </span></p>
218 <p class="p4">x.source = <span class="s4">Pbind</span>(<span class="s7">\dur</span>, 0.25, <span class="s7">\degree</span>, <span class="s4">Pseq</span>([3, 4, 5b, 6], <span class="s4">inf</span>), <span class="s7">\instrument</span>, <span class="s7">\gpdef</span>);</p>
219 <p class="p4">x.source = <span class="s4">Pbind</span>(<span class="s7">\dur</span>, 0.25, <span class="s7">\degree</span>, <span class="s4">Pseq</span>([3, 4, 5b, 6]+1, <span class="s4">inf</span>), <span class="s7">\instrument</span>, <span class="s7">\gpdef</span>);</p>
220 <p class="p4">y.source = <span class="s4">Pbind</span>(<span class="s7">\dur</span>, 0.25, <span class="s7">\degree</span>, <span class="s4">Pseq</span>([3, 4, 5b, 6]-1, <span class="s4">inf</span>), <span class="s7">\instrument</span>, <span class="s7">\gpdef</span>);</p>
221 <p class="p4">y.source = <span class="s4">Pbind</span>(<span class="s7">\dur</span>, 0.25, <span class="s7">\degree</span>, <span class="s4">Pseq</span>([3, 4, 5b]-2, <span class="s4">inf</span>), <span class="s7">\instrument</span>, <span class="s7">\gpdef</span>);</p>
222 <p class="p2"><br></p>
223 <p class="p6">// using fadeTime:</p>
224 <p class="p2"><br></p>
225 <p class="p4">y.fadeTime = 8.0;</p>
226 <p class="p4">y.source = <span class="s4">Pbind</span>(<span class="s7">\dur</span>, 0.125, <span class="s7">\degree</span>, <span class="s4">Pseq</span>([3, 4, 5b, 6]+4.rand, <span class="s4">inf</span>), <span class="s7">\instrument</span>, <span class="s7">\gpdef</span>);</p>
227 <p class="p4">y.source = <span class="s4">Pbind</span>(<span class="s7">\dur</span>, 0.25, <span class="s7">\degree</span>, <span class="s4">Pseq</span>([3, 4, 5b, 6]-2, <span class="s4">inf</span>), <span class="s7">\instrument</span>, <span class="s7">\gpdef</span>);</p>
228 <p class="p2"><br></p>
229 <p class="p4">(</p>
230 <p class="p4">x.source = <span class="s4">Pbind</span>(</p>
231 <p class="p4"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s7">\dur</span>, 1 / 6,<span class="Apple-converted-space"> </span></p>
232 <p class="p4"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s7">\degree</span>, <span class="s4">Pseq</span>([3, 4, <span class="s4">Prand</span>([8, 2, 3, 9, 10],1) - 5, 6]+1, <span class="s4">inf</span>),<span class="Apple-converted-space"> </span></p>
233 <p class="p5"><span class="s6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>\instrument<span class="s6">, </span>\gpdef</p>
234 <p class="p4"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>)</p>
235 <p class="p4"><span class="Apple-tab-span"> </span>);</p>
236 <p class="p4">)</p>
237 <p class="p4">(</p>
238 <p class="p4">x.source = <span class="s4">Pbind</span>(</p>
239 <p class="p4"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s7">\dur</span>, 0.25,<span class="Apple-converted-space"> </span></p>
240 <p class="p4"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s7">\degree</span>, <span class="s4">Pseq</span>([3, 4, <span class="s4">Prand</span>([8, 2, 3, 9, 10],1), 6], <span class="s4">inf</span>),<span class="Apple-converted-space"> </span></p>
241 <p class="p5"><span class="s6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>\instrument<span class="s6">, </span>\gpdef<span class="s6">)</span></p>
242 <p class="p4"><span class="Apple-tab-span"> </span>);</p>
243 <p class="p4">)</p>
244 <p class="p4">x.stop;</p>
245 <p class="p2"><br></p>
246 <p class="p2"><br></p>
247 <p class="p2"><br></p>
248 <p class="p6">// tempo change</p>
249 <p class="p4"><span class="s4">TempoClock</span>.default.tempo = 1.3;</p>
250 <p class="p4">y.source = <span class="s4">Pbind</span>(<span class="s7">\dur</span>, 0.25, <span class="s7">\degree</span>, <span class="s4">Pseq</span>([3, 4, 5, 6]+1, <span class="s4">inf</span>), <span class="s7">\instrument</span>, <span class="s7">\gpdef</span>);</p>
251 <p class="p2"><br></p>
252 <p class="p6">// drop in ending patterns</p>
253 <p class="p2"><br></p>
254 <p class="p4">x.play;</p>
255 <p class="p4">x.fadeTime = <span class="s4">nil</span>;</p>
256 <p class="p2"><br></p>
257 <p class="p4">x.source = <span class="s4">Pbind</span>(<span class="s7">\dur</span>, 0.25, <span class="s7">\degree</span>, <span class="s4">Pseq</span>([3, [7,4], 5, 6]-2), <span class="s7">\instrument</span>, <span class="s7">\gpdef</span>);</p>
258 <p class="p4">x.source = <span class="s4">Pbind</span>(<span class="s7">\dur</span>, 0.125, <span class="s7">\degree</span>, <span class="s4">Pseq</span>([3, [7,4], 5, 4]-3), <span class="s7">\instrument</span>, <span class="s7">\gpdef</span>);</p>
259 <p class="p4">x.source = <span class="s4">Pbind</span>(<span class="s7">\dur</span>, 0.35, <span class="s7">\degree</span>, <span class="s4">Pseq</span>([3, [7,4], 5, 4, 3]-3), <span class="s7">\instrument</span>, <span class="s7">\gpdef</span>);</p>
260 <p class="p4">x.source = <span class="s4">Pbind</span>(<span class="s7">\dur</span>, 0.25, <span class="s7">\degree</span>, <span class="s4">Pshuf</span>([3, [7,4], 5, 6]-2), <span class="s7">\instrument</span>, <span class="s7">\gpdef</span>);</p>
261 <p class="p2"><br></p>
262 <p class="p2"><br></p>
263 <p class="p2"><br></p>
264 <p class="p4"><span class="s4">TempoClock</span>.default.tempo = 1.0;</p>
265 <p class="p4">x.stop;</p>
266 <p class="p4">y.stop;</p>
267 <p class="p2"><br></p>
268 <p class="p2"><br></p>
269 </body>
270 </html>