Include a header file required for build on mac 10.4
[supercollider.git] / Help / Streams-Patterns-Events / Streams-Patterns-Events5.html
blob2b375939100e30665ec9023e9a5225dadaf601e7
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="824.44">
9 <style type="text/css">
10 p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica; min-height: 22.0px}
11 p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica}
12 p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica}
13 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
14 p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
15 p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #000000}
16 p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000}
17 p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #000000; min-height: 12.0px}
18 p.p9 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #0000bf}
19 p.p10 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica; min-height: 17.0px}
20 p.p11 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; min-height: 16.0px}
21 p.p12 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #007300}
22 p.p13 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #0000ff}
23 span.s1 {color: #0000bf}
24 span.s2 {color: #007300}
25 span.s3 {color: #000000}
26 span.s4 {color: #bf0000}
27 span.Apple-tab-span {white-space:pre}
28 </style>
29 </head>
30 <body>
31 <p class="p1"><br></p>
32 <p class="p2"><b>Understanding Streams, Patterns and Events - Part 5</b></p>
33 <p class="p1"><br></p>
34 <p class="p2"><b>More about the default Event</b></p>
35 <p class="p1"><br></p>
36 <p class="p3"><b>protoEvents</b></p>
37 <p class="p4"><br></p>
38 <p class="p5">The protoEvent contains default values for many useful parameters.</p>
39 <p class="p4"><br></p>
40 <p class="p5">The default protoEvent is Event.default. It provides default bindings for duration, envelope, instrument, making a very simple Pattern directly playable:</p>
41 <p class="p4"><br></p>
42 <p class="p6">(</p>
43 <p class="p7">// an endless sequence of middle Cs</p>
44 <p class="p6"><span class="s1">Pbind</span>.new.play</p>
45 <p class="p6">)</p>
46 <p class="p4"><span class="Apple-converted-space">  </span></p>
47 <p class="p5">By adding other bindings, you can override the defaults in the protoEvent.</p>
48 <p class="p4"><br></p>
49 <p class="p6">(</p>
50 <p class="p7">// duration 0.25 beats (16th notes)</p>
51 <p class="p6"><span class="s1">Pbind</span>( <span class="s2">\dur</span>, 0.25 ).play</p>
52 <p class="p6">)</p>
53 <p class="p8"><br></p>
54 <p class="p6">(</p>
55 <p class="p7">// specifying the pitch in terms of midinote</p>
56 <p class="p7">// see also The pitch model below</p>
57 <p class="p9">Pbind<span class="s3">(</span></p>
58 <p class="p6"><span class="Apple-tab-span"> </span><span class="s2">\dur</span>, 0.125,</p>
59 <p class="p6"><span class="Apple-tab-span"> </span><span class="s2">\legato</span>, 0.2,</p>
60 <p class="p6"><span class="Apple-tab-span"> </span><span class="s2">\midinote</span>, <span class="s1">Pseq</span>(#[60, 62, 64, 65, 67, 69, 71, 72], <span class="s1">inf</span>)</p>
61 <p class="p6">).play</p>
62 <p class="p6">)</p>
63 <p class="p4"><br></p>
64 <p class="p3"><b>~finish</b></p>
65 <p class="p10"><br></p>
66 <p class="p5">Event.default contains a function bound to the Symbol 'finish' which is called for each new event generated in order to complete any computations that depend on the other values in the event.<span class="Apple-converted-space"> </span></p>
67 <p class="p10"><br></p>
68 <p class="p3"><b>The pitch model</b></p>
69 <p class="p4"><br></p>
70 <p class="p5">Event.default implements a multi level pitch model which allows composition using modal scale degrees, equal division note values, midi note values, or frequencies in Hertz. These different ways of specifying the pitch can all be used interchangably.</p>
71 <p class="p4"><br></p>
72 <p class="p5">The way this works is due to the default values bound to the Symbols of the pitch model.</p>
73 <p class="p4"><br></p>
74 <p class="p5">The lowest level Symbol in the pitch model is 'freq'. The default binding for 'freq' is a Function which calculates the frequency by getting the value of 'midinote', adding a transpose value and converting it to Hertz using<span class="Apple-converted-space">  </span>midicps.<span class="Apple-converted-space"> </span></p>
75 <p class="p11"><br></p>
76 <p class="p6"><span class="Apple-tab-span"> </span>~freq = {</p>
77 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>(~midinote.value + ~ctranspose).midicps;</p>
78 <p class="p6"><span class="Apple-tab-span"> </span>};</p>
79 <p class="p11"><br></p>
80 <p class="p5">If you compose with 'freq' directly then this default function is overridden.<span class="Apple-converted-space"> </span></p>
81 <p class="p4"><br></p>
82 <p class="p6">(</p>
83 <p class="p9">Pbind<span class="s3">(</span></p>
84 <p class="p6"><span class="Apple-tab-span"> </span><span class="s2">\dur</span>, 0.25,</p>
85 <p class="p6"><span class="Apple-tab-span"> </span><span class="s2">\freq</span>, <span class="s1">Pseq</span>(#[300, 400, 500, 700, 900], <span class="s1">inf</span>)</p>
86 <p class="p6">).play;</p>
87 <p class="p6">)</p>
88 <p class="p11"><br></p>
89 <p class="p5">Event.default's 'finish' function sends the value message to the current binding of 'freq' in order to get the value for the frequency and adds a detune value to it which transposes the frequency in Hertz.</p>
90 <p class="p4"><br></p>
91 <p class="p6">(</p>
92 <p class="p9">Pbind<span class="s3">(</span></p>
93 <p class="p6"><span class="Apple-tab-span"> </span><span class="s2">\dur</span>, 0.25,</p>
94 <p class="p6"><span class="Apple-tab-span"> </span><span class="s2">\detune</span>, -20,</p>
95 <p class="p6"><span class="Apple-tab-span"> </span><span class="s2">\freq</span>, <span class="s1">Pseq</span>(#[300, 400, 500, 700, 900], <span class="s1">inf</span>)</p>
96 <p class="p6">).play</p>
97 <p class="p6">)</p>
98 <p class="p4"><br></p>
99 <p class="p5">The next level is 'midinote' which is by default bound to this function:</p>
100 <p class="p11"><br></p>
101 <p class="p6"><span class="Apple-tab-span"> </span>~midinote = {</p>
102 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>(~note.value + ~gtranspose + (~octave * divs) + ~root)</p>
103 <p class="p6"><span class="Apple-tab-span"> </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> * 12.0 / ~stepsPerOctave;</p>
104 <p class="p6"><span class="Apple-tab-span"> </span>};</p>
105 <p class="p4"><br></p>
106 <p class="p5">This function gets the value bound to 'note' which is a value expressed in some equal temperament, not necessarily 12. It adds a gamut transpose value 'gtranspose', and scales from the number of notes per octave being used into 12 notes per octave MIDI key values. If you compose with 'midinote' directly then that will override this function.</p>
107 <p class="p4"><br></p>
108 <p class="p6">(</p>
109 <p class="p9">Pbind<span class="s3">(</span></p>
110 <p class="p6"><span class="Apple-tab-span"> </span><span class="s2">\dur</span>, 0.2,</p>
111 <p class="p6"><span class="Apple-tab-span"> </span><span class="s2">\midinote</span>, <span class="s1">Pseq</span>([ <span class="s1">Pshuf</span>(#[60, 61, 62, 63, 64, 65, 66, 67], 3) ], <span class="s1">inf</span>)</p>
112 <p class="p6">).play</p>
113 <p class="p6">)</p>
114 <p class="p4"><br></p>
115 <p class="p5">Another level higher is 'note' which is defined by default by this function:</p>
116 <p class="p11"><br></p>
117 <p class="p6"><span class="Apple-tab-span"> </span>~note = {</p>
118 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s1">var</span> divs;</p>
119 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>divs = ~stepsPerOctave;</p>
120 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>(~degree + ~mtranspose).degreeToKey(~scale, divs);</p>
121 <p class="p6"><span class="Apple-tab-span"> </span>};</p>
122 <p class="p4"><br></p>
123 <p class="p5">This function derives the note value from the next higher level variables which specify a pitch from a scale. These variables are defined as follows:</p>
124 <p class="p4"><br></p>
125 <p class="p6"><span class="Apple-tab-span"> </span>~stepsPerOctave = 12.0;</p>
126 <p class="p5">The number of equal divisions of an octave for this tuning. The equal temperament defined by this variable is known as the gamut. If you wanted to work in cents for example you could set this to 1200.0.</p>
127 <p class="p4"><br></p>
128 <p class="p6"><span class="Apple-tab-span"> </span>~octave = 5.0;</p>
129 <p class="p5">The current octave. Middle C is the lowest note in octave 5.</p>
130 <p class="p4"><br></p>
131 <p class="p6"><span class="Apple-tab-span"> </span>~root = 0.0;</p>
132 <p class="p5">The root of the scale given in equal divisions defined by ~stepsPerOctave.</p>
133 <p class="p4"><br></p>
134 <p class="p6"><span class="Apple-tab-span"> </span>~scale = #[0, 2, 4, 5, 7, 9, 11]; <span class="s4">// diatonic major scale</span></p>
135 <p class="p5">A set of scale pitches given in equal divisions defined by ~stepsPerOctave.</p>
136 <p class="p4"><br></p>
137 <p class="p6"><span class="Apple-tab-span"> </span>~degree = 0;</p>
138 <p class="p5">A scale degree index into the ~scale. 0 is the root and the scale wraps in the manner defined by degreeToKey.</p>
139 <p class="p4"><br></p>
140 <p class="p6"><span class="Apple-tab-span"> </span>~mtranspose = 0;</p>
141 <p class="p5">A modal transposition value that is added to the scale degree.</p>
142 <p class="p4"><br></p>
143 <p class="p6"><span class="Apple-tab-span"> </span>~gtranspose = 0;</p>
144 <p class="p5">A gamut transposition value that is added to the gamut pitch.</p>
145 <p class="p4"><br></p>
146 <p class="p6"><span class="Apple-tab-span"> </span>~ctranspose = 0;</p>
147 <p class="p5">A chromatic transposition value expressed in semitones.</p>
148 <p class="p4"><br></p>
149 <p class="p3"><b>Pitch model Examples:</b></p>
150 <p class="p4"><br></p>
151 <p class="p6">(</p>
152 <p class="p7">// a simple scale degree sequence</p>
153 <p class="p9">Pbind<span class="s3">(</span></p>
154 <p class="p7"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// -7 is 8ve below, -3 is a 4th below,<span class="Apple-converted-space"> </span></p>
155 <p class="p7"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// 0 is root, 2 is 3rd above, 4 is 5th above, 7 is 8ve above.</p>
156 <p class="p6"><span class="Apple-tab-span"> </span><span class="s2">\degree</span>, <span class="s1">Pseq</span>([ <span class="s1">Pshuf</span>(#[-7,-3,0,2,4,7], 4), <span class="s1">Pseq</span>([0,1,2,3,4,5,6,7]) ], <span class="s1">inf</span>),</p>
157 <p class="p6"><span class="Apple-tab-span"> </span><span class="s2">\dur</span>, 0.15</p>
158 <p class="p6">).play</p>
159 <p class="p6">)</p>
160 <p class="p8"><br></p>
161 <p class="p8"><br></p>
162 <p class="p6">(</p>
163 <p class="p7">// change the octave</p>
164 <p class="p9">Pbind<span class="s3">(</span></p>
165 <p class="p6"><span class="Apple-tab-span"> </span><span class="s2">\dur</span>, 0.15,</p>
166 <p class="p12"><span class="s3"><span class="Apple-tab-span"> </span></span>\octave<span class="s3">, 4,</span></p>
167 <p class="p6"><span class="Apple-tab-span"> </span><span class="s2">\degree</span>, <span class="s1">Pseq</span>([ <span class="s1">Pshuf</span>(#[-7,-3,0,2,4,7], 4), <span class="s1">Pseq</span>([0,1,2,3,4,5,6,7]) ], <span class="s1">inf</span>)</p>
168 <p class="p6">).play</p>
169 <p class="p6">)</p>
170 <p class="p8"><br></p>
171 <p class="p8"><br></p>
172 <p class="p6">(</p>
173 <p class="p7">// change<span class="Apple-converted-space">  </span>the scale</p>
174 <p class="p9">Pbind<span class="s3">(</span></p>
175 <p class="p6"><span class="Apple-tab-span"> </span><span class="s2">\dur</span>, 0.15,</p>
176 <p class="p6"><span class="Apple-tab-span"> </span><span class="s2">\scale</span>, [0, 2, 3, 5, 7, 8, 10],</p>
177 <p class="p6"><span class="Apple-tab-span"> </span><span class="s2">\degree</span>, <span class="s1">Pseq</span>([ <span class="s1">Pshuf</span>(#[-7,-3,0,2,4,7], 4), <span class="s1">Pseq</span>([0,1,2,3,4,5,6,7]) ], <span class="s1">inf</span>)</p>
178 <p class="p6">).play</p>
179 <p class="p6">)</p>
180 <p class="p8"><br></p>
181 <p class="p8"><br></p>
182 <p class="p6">(</p>
183 <p class="p7">// modal transposition</p>
184 <p class="p6"><span class="s1">var</span> notes;</p>
185 <p class="p6">notes = <span class="s1">Pseq</span>([ <span class="s1">Pshuf</span>(#[-7,-3,0,2,4,7], 4), <span class="s1">Pseq</span>([0,1,2,3,4,5,6,7]) ], 1);</p>
186 <p class="p9">Pseq<span class="s3">([</span></p>
187 <p class="p9"><span class="s3"><span class="Apple-tab-span"> </span></span>Pbind<span class="s3">(</span></p>
188 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">\dur</span>, 0.15,</p>
189 <p class="p12"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>\mtranspose<span class="s3">, 0,</span></p>
190 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">\degree</span>, notes</p>
191 <p class="p6"><span class="Apple-tab-span"> </span>),</p>
192 <p class="p9"><span class="s3"><span class="Apple-tab-span"> </span></span>Pbind<span class="s3">(</span></p>
193 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">\dur</span>, 0.15,</p>
194 <p class="p12"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>\mtranspose<span class="s3">, 1,</span></p>
195 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">\degree</span>, notes</p>
196 <p class="p6"><span class="Apple-tab-span"> </span>),</p>
197 <p class="p9"><span class="s3"><span class="Apple-tab-span"> </span></span>Pbind<span class="s3">(</span></p>
198 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">\dur</span>, 0.15,</p>
199 <p class="p12"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>\mtranspose<span class="s3">, 2,</span></p>
200 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">\degree</span>, notes</p>
201 <p class="p6"><span class="Apple-tab-span"> </span>)</p>
202 <p class="p6">], <span class="s1">inf</span>).play</p>
203 <p class="p6">)</p>
204 <p class="p8"><br></p>
205 <p class="p8"><br></p>
206 <p class="p6">(</p>
207 <p class="p7">// chromatic transposition</p>
208 <p class="p6"><span class="s1">var</span> notes;</p>
209 <p class="p6">notes = <span class="s1">Pseq</span>([ <span class="s1">Pshuf</span>(#[-7,-3,0,2,4,7], 4), <span class="s1">Pseq</span>([0,1,2,3,4,5,6,7]) ], 1);</p>
210 <p class="p9">Pseq<span class="s3">([</span></p>
211 <p class="p9"><span class="s3"><span class="Apple-tab-span"> </span></span>Pbind<span class="s3">(</span></p>
212 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">\dur</span>, 0.15,</p>
213 <p class="p12"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>\ctranspose<span class="s3">, 0,</span></p>
214 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">\degree</span>, notes</p>
215 <p class="p6"><span class="Apple-tab-span"> </span>),</p>
216 <p class="p9"><span class="s3"><span class="Apple-tab-span"> </span></span>Pbind<span class="s3">(</span></p>
217 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">\dur</span>, 0.15,</p>
218 <p class="p12"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>\ctranspose<span class="s3">, 3,</span></p>
219 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">\degree</span>, notes</p>
220 <p class="p6"><span class="Apple-tab-span"> </span>),</p>
221 <p class="p9"><span class="s3"><span class="Apple-tab-span"> </span></span>Pbind<span class="s3">(</span></p>
222 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">\dur</span>, 0.15,</p>
223 <p class="p12"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>\ctranspose<span class="s3">, -3,</span></p>
224 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">\degree</span>, notes</p>
225 <p class="p6"><span class="Apple-tab-span"> </span>)</p>
226 <p class="p6">], <span class="s1">inf</span>).play</p>
227 <p class="p6">)</p>
228 <p class="p8"><br></p>
229 <p class="p8"><br></p>
230 <p class="p6">(</p>
231 <p class="p7">// frequency detuning</p>
232 <p class="p6"><span class="s1">var</span> notes;</p>
233 <p class="p6">notes = <span class="s1">Pseq</span>([ <span class="s1">Pshuf</span>(#[-7,-3,0,2,4,7], 4), <span class="s1">Pseq</span>([0,1,2,3,4,5,6,7]) ], 1);</p>
234 <p class="p9">Pseq<span class="s3">([</span></p>
235 <p class="p9"><span class="s3"><span class="Apple-tab-span"> </span></span>Pbind<span class="s3">(</span></p>
236 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">\dur</span>, 0.15,</p>
237 <p class="p12"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>\detune<span class="s3">, 0,</span></p>
238 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">\degree</span>, notes</p>
239 <p class="p6"><span class="Apple-tab-span"> </span>),</p>
240 <p class="p9"><span class="s3"><span class="Apple-tab-span"> </span></span>Pbind<span class="s3">(</span></p>
241 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">\dur</span>, 0.15,</p>
242 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">\detune</span>, 20,</p>
243 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">\degree</span>, notes</p>
244 <p class="p6"><span class="Apple-tab-span"> </span>),</p>
245 <p class="p9"><span class="s3"><span class="Apple-tab-span"> </span></span>Pbind<span class="s3">(</span></p>
246 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">\dur</span>, 0.15,</p>
247 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">\detune</span>, 40,</p>
248 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">\degree</span>, notes</p>
249 <p class="p6"><span class="Apple-tab-span"> </span>)</p>
250 <p class="p6">], <span class="s1">inf</span>).play</p>
251 <p class="p6">)</p>
252 <p class="p8"><br></p>
253 <p class="p8"><br></p>
254 <p class="p6">(</p>
255 <p class="p7">// chords. If an Array of pitches is returned by a Stream for pitch, then a chord</p>
256 <p class="p7">// will be played.</p>
257 <p class="p9">Pbind<span class="s3">(</span></p>
258 <p class="p6"><span class="Apple-tab-span"> </span><span class="s2">\dur</span>, 0.15,</p>
259 <p class="p12"><span class="s3"><span class="Apple-tab-span"> </span></span>\degree<span class="s3">, </span><span class="s1">Pseq</span><span class="s3">([<span class="Apple-converted-space"> </span></span></p>
260 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s1">Pshuf</span>(#[-7,-3,0,2,4,7], 4)+[0,4],</p>
261 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s1">Pseq</span>( [0,1,2,3,4,5,6,7] )+[0,2]</p>
262 <p class="p6"><span class="Apple-tab-span"> </span>], <span class="s1">inf</span>)</p>
263 <p class="p6">).play</p>
264 <p class="p6">)</p>
265 <p class="p8"><br></p>
266 <p class="p8"><br></p>
267 <p class="p6">(</p>
268 <p class="p7">// composing in non 12 equal temperaments.<span class="Apple-converted-space">  </span>72 tone equal temp.</p>
269 <p class="p9">Pbind<span class="s3">(</span></p>
270 <p class="p12"><span class="s3"><span class="Apple-tab-span"> </span></span>\stepsPerOctave<span class="s3">, 72,</span></p>
271 <p class="p6"><span class="Apple-tab-span"> </span><span class="s2">\note</span>, <span class="s1">Pseq</span>([</p>
272 <p class="p7"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>//<span class="Apple-converted-space">  </span>1/1, 7/6, 3/2, 7/4, 9/8</p>
273 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s1">Pseq</span>([ [0,16,42,58,84], <span class="s1">Pseq</span>([ 0, 16, 42, 58, 72, 84 ], 2), [0,16,42,58,84] ], 1),</p>
274 <p class="p7"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>//<span class="Apple-converted-space">  </span>1/1, 6/5, 3/2, 9/5, 9/8</p>
275 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s1">Pseq</span>([ [0,19,42,61,84], <span class="s1">Pseq</span>([ 0, 19, 42, 61, 72, 84 ], 2), [0,19,42,61,84] ], 1),</p>
276 <p class="p7"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>//<span class="Apple-converted-space">  </span>1/1, 5/4, 3/2, 15/8, 9/8</p>
277 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s1">Pseq</span>([ [0,23,42,65,84], <span class="s1">Pseq</span>([ 0, 23, 42, 65, 72, 84 ], 2), [0,23,42,65,84] ], 1),</p>
278 <p class="p7"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>//<span class="Apple-converted-space">  </span>1/1, 9/7, 3/2, 27/14, 9/8</p>
279 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s1">Pseq</span>([ [0,26,42,68,84], <span class="s1">Pseq</span>([ 0, 26, 42, 68, 72, 84 ], 2), [0,26,42,68,84] ], 1)</p>
280 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>], <span class="s1">inf</span>),</p>
281 <p class="p6"><span class="Apple-tab-span"> </span><span class="s2">\dur</span>, <span class="s1">Pseq</span>([ 1.2, <span class="s1">Pseq</span>([0.15], 12), 1.2], <span class="s1">inf</span>)</p>
282 <p class="p6">).play</p>
283 <p class="p6">)</p>
284 <p class="p4"><br></p>
285 <p class="p3"><b>The duration model</b></p>
286 <p class="p4"><br></p>
287 <p class="p5">Duration is expressed in beats and is bound to the 'dur' symbol. The sustain time of a note can be expressed directly in beats or by using a legato value which is multiplied by the note duration to get the sustain time.</p>
288 <p class="p4"><br></p>
289 <p class="p6">(</p>
290 <p class="p7">// changing duration</p>
291 <p class="p9">Pbind<span class="s3">(</span></p>
292 <p class="p6"><span class="Apple-tab-span"> </span><span class="s2">\dur</span>, <span class="s1">Pseq</span>([ <span class="s1">Pgeom</span>(0.05, 1.1, 24), <span class="s1">Pgeom</span>(0.5, 0.909, 24) ], <span class="s1">inf</span>),</p>
293 <p class="p6"><span class="Apple-tab-span"> </span><span class="s2">\midinote</span>, <span class="s1">Pseq</span>(#[60, 58], <span class="s1">inf</span>)</p>
294 <p class="p6">).play</p>
295 <p class="p6">)</p>
296 <p class="p8"><br></p>
297 <p class="p8"><br></p>
298 <p class="p6">(</p>
299 <p class="p7">// changing legato value</p>
300 <p class="p9">Pbind<span class="s3">(</span></p>
301 <p class="p6"><span class="Apple-tab-span"> </span><span class="s2">\dur</span>, 0.2,</p>
302 <p class="p6"><span class="Apple-tab-span"> </span><span class="s2">\legato</span>, <span class="s1">Pseq</span>([ <span class="s1">Pseries</span>(0.05, 0.05, 40), <span class="s1">Pseries</span>(2.05, -0.05, 40) ], <span class="s1">inf</span>),</p>
303 <p class="p6"><span class="Apple-tab-span"> </span><span class="s2">\midinote</span>, <span class="s1">Pseq</span>(#[48, 51, 55, 58, 60, 58, 55, 51], <span class="s1">inf</span>)</p>
304 <p class="p6">).play</p>
305 <p class="p6">)</p>
306 <p class="p10"><br></p>
307 <p class="p5">To go to the next file:</p>
308 <p class="p13"><a href="Streams-Patterns-Events6.html">Streams-Patterns-Events6</a></p>
309 <p class="p10"><br></p>
310 </body>
311 </html>