1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8">
5 <meta http-equiv=
"Content-Style-Type" content=
"text/css">
7 <meta name=
"Generator" content=
"Cocoa HTML Writer">
8 <meta name=
"CocoaVersion" content=
"824.48">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 18.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: 12.0px Helvetica
}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica
}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica
; min-height: 17.0px}
15 p
.p6
{margin: 0.0px 0.0px 0.0px 0.0px; font: 15.0px Helvetica
}
16 p
.p7
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
}
17 p
.p8
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #bf0000}
18 p
.p9
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; min-height: 12.0px}
19 p
.p10
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #0000bf; min-height: 12.0px}
20 p
.p11
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #606060}
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: 9.0px Monaco
; color: #0000bf}
23 span
.s1
{font: 12.0px Monaco
}
24 span
.s2
{font: 14.0px Helvetica
}
25 span
.s3
{color: #0000bf}
26 span
.s4
{color: #000000}
27 span
.s5
{color: #007300}
28 span
.s6
{font: 12.0px Helvetica
}
29 span
.s7
{font: 9.0px Monaco
}
30 span
.s8
{font: 12.0px Helvetica
; color: #000000}
31 span
.Apple-tab-span
{white-space:pre
}
35 <p class=
"p1"><b>Pattern
</b></p>
36 <p class=
"p2"><br></p>
37 <p class=
"p3"><b>superclass: AbstractFunction
</b></p>
38 <p class=
"p2"><br></p>
39 <p class=
"p4"><b>Patterns versus Streams
</b></p>
40 <p class=
"p2"><br></p>
41 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>Pattern
</b>is an abstract class that is the base for the Patterns library.
<span class=
"Apple-converted-space"> </span>These classes form a
<span class=
"Apple-converted-space"> </span></p>
42 <p class=
"p3">rich and concise score language for music. The series of help files entitled
<b>Streams-Patterns-Events
<span class=
"Apple-converted-space"> </span></b></p>
43 <p class=
"p3">gives a detailed introduction. This attemps a briefer characterization.
</p>
44 <p class=
"p2"><br></p>
45 <p class=
"p3"><span class=
"Apple-tab-span"> </span>A
<b>Stream
</b> is an object that responds to
<span class=
"s1">next, reset,
</span>and
<span class=
"s1">embedInStream.
</span>Streams
<span class=
"Apple-converted-space"> </span></p>
46 <p class=
"p3">represent sequences of values that are obtained one at a time by with message
<span class=
"s1">next
</span>.
<span class=
"Apple-converted-space"> </span>A
<span class=
"s1">reset
</span><b><span class=
"Apple-converted-space"> </span></b></p>
47 <p class=
"p3">message will cause the stream to restart (many but
<span class=
"Apple-converted-space"> </span>not all streams actually repeat themselves.)
<span class=
"Apple-converted-space"> </span></p>
48 <p class=
"p3">If a stream runs out of
<span class=
"Apple-converted-space"> </span>values it returns
<span class=
"s1">nil
</span> in response to
<span class=
"s1">next
</span>.
<span class=
"Apple-converted-space"> </span>The message
<span class=
"s1">embedInStream
</span></p>
49 <p class=
"p3">allows a stream definition to allow another stream to
<span class=
"Apple-converted-space"> </span>"take over control" of the stream.
</p>
50 <p class=
"p3">All objects respond to
<span class=
"s1">next
</span> and
<span class=
"s1">reset,
</span>most by returning themselves in response to next.
<span class=
"Apple-converted-space"> </span></p>
51 <p class=
"p3">Thus, the number
7 defines a Stream that produces an infinite sequence of
7's. Most objects
<span class=
"Apple-converted-space"> </span></p>
52 <p class=
"p3">respond to
<span class=
"s1">embedInStream
</span>with a singleton Stream that returns the object once.
<span class=
"Apple-converted-space"> </span></p>
53 <p class=
"p2"><br></p>
54 <p class=
"p3"><span class=
"Apple-tab-span"> </span>A
<b>Pattern
</b>is an object that responds to
<span class=
"s1">asStream
</span>and
<span class=
"s1">embedInStream.
<span class=
"Apple-converted-space"> </span>A
</span>Pattern
</p>
55 <p class=
"p3">defines the behavior of a Stream and creates such streams in response to the messages
<span class=
"s1">asStream.
</span></p>
56 <p class=
"p3">The difference between a Pattern and a Stream is similar to the
<span class=
"Apple-converted-space"> </span>difference between a score
<span class=
"Apple-converted-space"> </span>and a
<span class=
"Apple-converted-space"> </span></p>
57 <p class=
"p3">performance of that score or a class and an instance of that class.
<span class=
"Apple-converted-space"> </span>All objects respond to this interface,
<span class=
"Apple-converted-space"> </span></p>
58 <p class=
"p3">most by returning themselves.
<span class=
"Apple-converted-space"> </span>So most objects are patterns that define streams that are an infinite
<span class=
"Apple-converted-space"> </span></p>
59 <p class=
"p3">sequence of the object and embed as singleton streams of that object returned once.
</p>
60 <p class=
"p2"><br></p>
61 <p class=
"p3"><span class=
"Apple-tab-span"> </span>Patterns are defined in terms of other Patterns rather than in terms of specific
<span class=
"Apple-converted-space"> </span></p>
62 <p class=
"p3">values.
<span class=
"Apple-converted-space"> </span>This allows a Pattern of arbitrary complexity to be substituted for a
<span class=
"Apple-converted-space"> </span></p>
63 <p class=
"p3">single value anywhere within a Pattern definition.
<span class=
"Apple-converted-space"> </span>A comparison between a Stream
</p>
64 <p class=
"p3">definition and a Pattern will help illustrate the usefulness of Patterns.
</p>
65 <p class=
"p2"><br></p>
66 <p class=
"p4"><b>example
1 - Pseq vs. Routine
</b></p>
67 <p class=
"p5"><br></p>
68 <p class=
"p3">The
<span class=
"s2"> </span>Pattern class
<b>Pseq(array, repetitions)
</b>defines a Pattern that will create a Stream that iterates
<span class=
"Apple-converted-space"> </span></p>
69 <p class=
"p3">an array. The class
<b>Routine(func, stackSize)
</b>defines a single Stream, the function that runs within
</p>
70 <p class=
"p3">that stream is defined to perform the array iteration.
<span class=
"Apple-converted-space"> </span></p>
71 <p class=
"p2"><br></p>
72 <p class=
"p3">Below a stream is created with
<b>Pseq
</b>and an
<span class=
"s1">asStream
</span><b> </b>message and an identical stream is
<span class=
"Apple-converted-space"> </span></p>
73 <p class=
"p3">created directly using
<b>Routine
</b>.
</p>
74 <p class=
"p2"><br></p>
75 <p class=
"p3"><span class=
"Apple-converted-space"> </span><b>// a Routine vs a Pattern
<span class=
"Apple-converted-space"> </span></b></p>
77 <p class=
"p2"><br></p>
78 <p class=
"p3"><span class=
"Apple-tab-span"> </span>a = [-
100,
00,
300,
400];
<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>// the array to iterate
</p>
79 <p class=
"p2"><br></p>
80 <p class=
"p3"><span class=
"Apple-tab-span"> </span>p = Pseq(a);
<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><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>// make the Pattern
</p>
81 <p class=
"p3"><span class=
"Apple-tab-span"> </span>q = p.asStream;
<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><span class=
"Apple-tab-span"> </span>// have the Pattern make a Stream
</p>
82 <p class=
"p3"><span class=
"Apple-tab-span"> </span>r = Routine({ a.do({ arg v; v.yield}) }) ;
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>// make the Stream directly
</p>
83 <p class=
"p2"><br></p>
84 <p class=
"p3"><span class=
"Apple-tab-span"> </span>5.do({ Post
<< Char.tab
<< r.next
<< " " << q.next
<< Char.nl; });
</p>
86 <p class=
"p2"><br></p>
87 <p class=
"p4"><b>example
2 - Nesting patterns
</b></p>
88 <p class=
"p2"><br></p>
89 <p class=
"p3"><span class=
"Apple-tab-span"> </span>In example
1, there is little difference between using
<span class=
"Apple-converted-space"> </span>Pseq and Routine.
<span class=
"Apple-converted-space"> </span>But Pseq actually
<span class=
"Apple-converted-space"> </span></p>
90 <p class=
"p3">iterates its array as
<span class=
"Apple-converted-space"> </span>a collection of
<i>patterns to be embedded
</i>, allowing another Pseq to replace any
</p>
91 <p class=
"p3">of the values in the array.
<span class=
"Apple-converted-space"> </span>The Routine, on the other hand,
<span class=
"Apple-converted-space"> </span>needs to be completely
<span class=
"Apple-converted-space"> </span></p>
92 <p class=
"p3">redefined.
</p>
93 <p class=
"p2"><br></p>
95 <p class=
"p3"><span class=
"Apple-tab-span"> </span>var routinesA;
</p>
96 <p class=
"p3"><span class=
"Apple-tab-span"> </span>a = [
3, Pseq([-
100,
00,
300,
400]), Pseq([-
100,
00,
300,
400].reverse) ];
</p>
97 <p class=
"p3"><span class=
"Apple-tab-span"> </span>routinesA = [[
3], [-
100,
00,
300,
400], [-
100,
00,
300,
400].reverse];
</p>
98 <p class=
"p3"><span class=
"Apple-tab-span"> </span>p = Pseq(a);
</p>
99 <p class=
"p3"><span class=
"Apple-tab-span"> </span>q = p.asStream;
</p>
100 <p class=
"p2"><br></p>
101 <p class=
"p3"><span class=
"Apple-tab-span"> </span>r = Routine({
<span class=
"Apple-converted-space"> </span></p>
102 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>routinesA.do({ arg v;
<span class=
"Apple-converted-space"> </span></p>
103 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>v.do({ arg i; i.yield})
<span class=
"Apple-converted-space"> </span></p>
104 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>}) ;
</p>
105 <p class=
"p3"><span class=
"Apple-tab-span"> </span>});
</p>
106 <p class=
"p3"><span class=
"Apple-tab-span"> </span>10.do({ Post
<< Char.tab
<< r.next
<< " " << q.next
<< Char.nl; });
</p>
107 <p class=
"p3">)
<span class=
"Apple-tab-span"> </span></p>
108 <p class=
"p2"><br></p>
109 <p class=
"p4"><b>example
3 - Stream-embedInStream
</b></p>
110 <p class=
"p2"><br></p>
111 <p class=
"p3">The message
<span class=
"s1">embedInStream
</span> is what allows Patterns to do this kind of nesting. Most
<span class=
"Apple-converted-space"> </span>objects
<span class=
"Apple-converted-space"> </span></p>
112 <p class=
"p3">(such as the number
3 below) respond to
<span class=
"s1">embedInStream
</span><b> </b>by yielding themselves once and returning.
</p>
113 <p class=
"p3">Streams respond to embedInStream by iterating themselves to completion, effectively
"taking over" the
<span class=
"Apple-converted-space"> </span></p>
114 <p class=
"p3">calling stream for that time.
<span class=
"Apple-converted-space"> </span></p>
115 <p class=
"p2"><br></p>
116 <p class=
"p3">A Routine can perform a pattern simply by replacing calls to
<span class=
"s1">yield
</span>with calls to
<span class=
"s1">embedInStream.
</span></p>
117 <p class=
"p3">(
<span class=
"Apple-converted-space"> </span></p>
118 <p class=
"p3"><span class=
"Apple-tab-span"> </span>a = [
3, Pseq([-
100,
00,
300,
400]), Pseq([-
100,
00,
300,
400].reverse) ];
</p>
119 <p class=
"p2"><br></p>
120 <p class=
"p3"><span class=
"Apple-tab-span"> </span>r = Routine({ a.do({ arg v; v.
<i>embedInStream
</i>}) }) ;
</p>
121 <p class=
"p3"><span class=
"Apple-tab-span"> </span>p = Pseq(a);
</p>
122 <p class=
"p3"><span class=
"Apple-tab-span"> </span>q = p.asStream;
</p>
123 <p class=
"p3"><span class=
"Apple-tab-span"> </span>10.do({ Post
<< Char.tab
<< r.next
<< " " << q.next
<< Char.nl; });
</p>
124 <p class=
"p3">)
<span class=
"Apple-tab-span"> </span></p>
125 <p class=
"p2"><br></p>
126 <p class=
"p3">Of course, there is no concise way to
<i>define
</i> this stream without using Pseq.
<span class=
"Apple-converted-space"> </span></p>
127 <p class=
"p2"><br></p>
128 <p class=
"p3"><b>note:
</b>For reasons of efficiency, the implementation of embedInStream assumes that it is called from
</p>
129 <p class=
"p3">within a Routine. Consequently, embedInStream should never be called from within the function that
</p>
130 <p class=
"p3">defines a FuncStream or a Pfunc (the pattern that creates FuncStreams).
</p>
131 <p class=
"p2"><span class=
"Apple-converted-space"> </span></p>
132 <p class=
"p6"><b>Event Patterns
</b></p>
133 <p class=
"p2"><br></p>
134 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span></b>An Event is a Environment with a 'play' method.
<span class=
"Apple-converted-space"> </span>Typically, an Event consists of
</p>
135 <p class=
"p3">a collection of key/value pairs that determine what the play method actually does.
</p>
136 <p class=
"p3">The values may be any object including functions defined in terms of other named attributes.
<span class=
"Apple-converted-space"> </span></p>
137 <p class=
"p3">Changing those values can generate a succession of sounds sometimes called 'music'...
</p>
138 <p class=
"p3">The pattern
<b>Pbind
</b>connects specific patterns with specific names. Consult its help page for
<span class=
"Apple-converted-space"> </span></p>
139 <p class=
"p3">details.
</p>
140 <p class=
"p2"><br></p>
141 <p class=
"p6"><b>Playing Event Patterns
</b></p>
142 <p class=
"p2"><br></p>
143 <p class=
"p3"><b>play(clock, protoEvent, quant)
</b></p>
144 <p class=
"p3"><b>clock
</b> - The tempo clock that will run the pattern. If omitted, TempoClock.default is used.
</p>
145 <p class=
"p3"><b>protoEvent
</b> - The event prototype that will be fed into the pattern stream on each iteration. If omitted, event.default is used.
</p>
146 <p class=
"p3"><b>quant
</b> - see the
<a href=
"../../Scheduling/Quant.html"><span class=
"s3">Quant
</span></a> helpfile
</p>
147 <p class=
"p2"><br></p>
148 <p class=
"p3">The play method does not return the pattern itself. Instead, it returns the
<a href=
"../EventStreamPlayer.html"><span class=
"s3">EventStreamPlayer
</span></a> object that actually runs the pattern. Control instructions -- stop, pause, resume, play, reset -- should be addressed to the EventStreamPlayer. (The same pattern can play many times simultaneously, using different EventStreamPlayers.)
</p>
149 <p class=
"p2"><br></p>
150 <p class=
"p7">p =
<span class=
"s3">Pbind
</span>(...);
</p>
151 <p class=
"p7">p.play;
</p>
152 <p class=
"p8"><span class=
"s4">p.stop;
<span class=
"Apple-tab-span"> </span></span>// does not stop because p is not the EventStreamPlayer that is actually playing
</p>
153 <p class=
"p9"><br></p>
154 <p class=
"p7">p =
<span class=
"s3">Pbind
</span>(...).play;
</p>
155 <p class=
"p8"><span class=
"s4">p.stop;
<span class=
"Apple-tab-span"> </span></span>// DOES stop because p is the EventStreamPlayer
</p>
156 <p class=
"p2"><br></p>
157 <p class=
"p6"><b>Recording Event Patterns
</b></p>
158 <p class=
"p2"><br></p>
159 <p class=
"p3">Patterns may be recorded in realtime or non-realtime.
</p>
160 <p class=
"p2"><br></p>
161 <p class=
"p4"><b>Realtime:
</b></p>
162 <p class=
"p3"><b>record(path, headerFormat, sampleFormat, numChannels, dur, fadeTime, clock, protoEvent, server, out)
</b></p>
163 <p class=
"p2"><br></p>
164 <p class=
"p3">Opens a disk file for recording and plays the pattern into it.
</p>
165 <p class=
"p2"><br></p>
166 <p class=
"p3"><b>path
</b> - Disk location for the recorded file. If not given, a filename is generated for you and placed in the default recording directory: thisProcess.platform.recordingsDir.
</p>
167 <p class=
"p3"><b>headerFormat
</b> - File format, default
"AIFF" - see
<a href=
"../../Files/SoundFile.html"><span class=
"s3">SoundFile
</span></a> for supported header and sample formats.
</p>
168 <p class=
"p3"><b>sampleFormat
</b> - Sample format, default
"float"</p>
169 <p class=
"p3"><b>numChannels
</b> - Number of channels to recorde, default
2</p>
170 <p class=
"p3"><b>dur
</b> - How long to run the pattern before stopping. If nil (default), the pattern will run until it finishes on its own; then recording stops. Or, use cmd-period to stop the recording. If a number is given, the pattern will run for that many beats and then stop (using
<a href=
"Pfindur.html"><span class=
"s3">Pfindur
</span></a>), ending the recording as well.
</p>
171 <p class=
"p3"><b>fadeTime
</b> - How many beats to allow after the last event before stopping the recording. Default =
0.2.
</p>
172 <p class=
"p3"><b>clock
</b> - Which clock to use for play. Uses TempoClock.default if not otherwise specified.
</p>
173 <p class=
"p3"><b>protoEvent
</b> - Which event prototype to use for play. Falls back to Event.default if not otherwise specified.
</p>
174 <p class=
"p3"><b>server
</b> - Which server to play and record. Server.default if not otherwise specified.
</p>
175 <p class=
"p3"><b>out
</b> - Output bus to hear the pattern while recording, default =
0.
</p>
176 <p class=
"p2"><br></p>
177 <p class=
"p3"><span class=
"s2"><b>Non-realtime:
</b></span> See the
<a href=
"../../Control/Score.html"><span class=
"s3">Score
</span></a> helpfile, especially
"creating Score from a pattern." It can be tricky, because NRT recording launches a new server instance. That server instance is not aware of buffers or other resources loaded into the realtime server you might have been using for tests. The pattern is responsible for (re)loading any resources (buffers, effects etc.).
<a href=
"Pfset.html"><span class=
"s3">Pfset
</span></a> or
<a href=
"Pproto.html"><span class=
"s3">Pproto
</span></a> may be useful.
</p>
178 <p class=
"p2"><br></p>
179 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-converted-space"> </span></p>
180 <p class=
"p4"><b>A Summary of Pattern classes
</b></p>
181 <p class=
"p5"><br></p>
182 <p class=
"p3"><span class=
"Apple-tab-span"> </span>Below are brief examples for
<span class=
"Apple-converted-space"> </span>most of the classes derived from Pattern. These examples
</p>
183 <p class=
"p3">all rely on the patterns assigned to the Interpreter variable p, q, and r in the first block of code.
</p>
184 <p class=
"p5"><br></p>
185 <p class=
"p10"><br></p>
187 <p class=
"p7"><span class=
"s3">SynthDef
</span>(
<span class=
"s5">\cfstring1
</span>.postln, {
<span class=
"s3">arg
</span> i_out, freq =
360, gate =
1, pan, amp=
0.1;
</p>
188 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s3">var
</span> out, eg, fc, osc, a, b, w;
</p>
189 <p class=
"p7"><span class=
"Apple-tab-span"> </span>fc =
<span class=
"s3">LinExp
</span>.kr(
<span class=
"s3">LFNoise1
</span>.kr(
<span class=
"s3">Rand
</span>(
0.25,
0.4)), -
1,
1,
500,
2000);
</p>
190 <p class=
"p7"><span class=
"Apple-tab-span"> </span>osc =
<span class=
"s3">Mix
</span>.fill(
8, {
<span class=
"s3">LFSaw
</span>.ar(freq * [
<span class=
"s3">Rand
</span>(
0.99,
1.01),
<span class=
"s3">Rand
</span>(
0.99,
1.01)],
0, amp) }).distort *
0.2;
</p>
191 <p class=
"p7"><span class=
"Apple-tab-span"> </span>eg =
<span class=
"s3">EnvGen
</span>.kr(
<span class=
"s3">Env
</span>.asr(
1,
1,
1), gate, doneAction:
2);
</p>
192 <p class=
"p7"><span class=
"Apple-tab-span"> </span>out = eg *
<span class=
"s3">RLPF
</span>.ar(osc, fc,
0.1);
</p>
193 <p class=
"p7"><span class=
"Apple-tab-span"> </span>#a, b = out;
</p>
194 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s3">Out
</span>.ar(i_out,
<span class=
"s3">Mix
</span>.ar(
<span class=
"s3">PanAz
</span>.ar(
4, [a, b], [pan, pan+
0.3])));
</p>
195 <p class=
"p7">}).add;
</p>
196 <p class=
"p9"><br></p>
197 <p class=
"p11"><span class=
"s3">SynthDef
</span><span class=
"s4">(
</span>"sinegrain2"<span class=
"s4">,
<span class=
"Apple-converted-space"> </span></span></p>
198 <p class=
"p7"><span class=
"Apple-tab-span"> </span>{
<span class=
"s3">arg
</span> out=
0, freq=
440, sustain=
0.05, pan;
</p>
199 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">var
</span> env;
</p>
200 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>env =
<span class=
"s3">EnvGen
</span>.kr(
<span class=
"s3">Env
</span>.perc(
0.01, sustain,
0.3), doneAction:
2);
</p>
201 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">Out
</span>.ar(out,
<span class=
"s3">Pan2
</span>.ar(
<span class=
"s3">SinOsc
</span>.ar(freq,
0, env), pan))
</p>
202 <p class=
"p7"><span class=
"Apple-tab-span"> </span>}).add;
</p>
203 <p class=
"p9"><br></p>
204 <p class=
"p7">p =
<span class=
"s3">Pbind
</span>(
</p>
205 <p class=
"p7"><span class=
"Apple-tab-span"> </span>[
<span class=
"s5">\degree
</span>,
<span class=
"s5">\dur
</span>],
<span class=
"s3">Pseq
</span>([[
0,
0.1], [
2,
0.1], [
3,
0.1], [
4,
0.1], [
5,
0.8]],
1),
<span class=
"Apple-converted-space"> </span></p>
206 <p class=
"p12"><span class=
"s4"><span class=
"Apple-tab-span"> </span></span>\amp
<span class=
"s4">,
0.05,
</span>\octave
<span class=
"s4">,
6,
</span>\instrument
<span class=
"s4">,
</span>\cfstring1
<span class=
"s4">,
</span>\mtranspose
<span class=
"s4">,
0);
</span></p>
207 <p class=
"p9"><br></p>
208 <p class=
"p12"><span class=
"s4">q =
</span><span class=
"s3">Pbindf
</span><span class=
"s4">(p,
</span>\instrument
<span class=
"s4">,
</span>\default
<span class=
"s4"> );
</span></p>
209 <p class=
"p9"><br></p>
210 <p class=
"p7">r =
<span class=
"s3">Pset
</span>(
<span class=
"s5">\freq
</span>,
<span class=
"s3">Pseq
</span>([
500,
600,
700],
2), q);
</p>
211 <p class=
"p9"><br></p>
213 <p class=
"p2"><br></p>
214 <p class=
"p3"><b>// EVENT PATTERNS - patterns that generate or require event streams
</b></p>
215 <p class=
"p2"><br></p>
216 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>// Pbind( ArrayOfPatternPairs )
</b></p>
217 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
218 <p class=
"p7"><span class=
"s6"><b><span class=
"Apple-tab-span"> </span></b></span>p =
<span class=
"s3">Pbind
</span>(
</p>
219 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>[
<span class=
"s5">\degree
</span>,
<span class=
"s5">\dur
</span>],
<span class=
"s3">Pseq
</span>([[
0,
0.1], [
2,
0.1], [
3,
0.1], [
4,
0.1], [
5,
0.8]],
1),
<span class=
"Apple-converted-space"> </span></p>
220 <p class=
"p12"><span class=
"s4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>\amp
<span class=
"s4">,
0.05,
</span>\octave
<span class=
"s4">,
6,
</span>\instrument
<span class=
"s4">,
</span>\cfstring1
<span class=
"s4">,
</span>\mtranspose
<span class=
"s4">,
0);
</span></p>
221 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
222 <p class=
"p7"><span class=
"Apple-tab-span"> </span>p.play;
</p>
223 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
224 <p class=
"p3"><span class=
"s7"><span class=
"Apple-tab-span"> </span></span><b>//Ppar(arrayOfPatterns, repeats) - play in parallel
</b></p>
225 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
226 <p class=
"p7"><span class=
"s6"><b><span class=
"Apple-tab-span"> </span></b></span><span class=
"s3">Ppar
</span>([
<span class=
"s3">Pseq
</span>([p],
4),
<span class=
"s3">Pseq
</span>([
<span class=
"s3">Pbindf
</span>(q,
<span class=
"s5">\ctranspose
</span>, -
24)],
5)]).play
</p>
227 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
228 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>//Ptpar(arrayOfTimePatternPairs, repeats) - play in parallel at different times
</b></p>
229 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
230 <p class=
"p7"><span class=
"s6"><b><span class=
"Apple-tab-span"> </span></b></span><span class=
"s3">Ptpar
</span>([
1,
<span class=
"s3">Pseq
</span>([p],
4),
0,
<span class=
"s3">Pseq
</span>([
<span class=
"s3">Pbindf
</span>(q,
<span class=
"s5">\ctranspose
</span>, -
24)],
5)]).play
</p>
231 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
232 <p class=
"p3"><span class=
"s7"><span class=
"Apple-tab-span"> </span></span><b>// Pbindf( pattern, ArrayOfNamePatternPairs )
</b></p>
233 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
234 <p class=
"p12"><span class=
"s4"><span class=
"Apple-tab-span"> </span>q =
</span><span class=
"s3">Pbindf
</span><span class=
"s4">(p,
</span>\instrument
<span class=
"s4">,
</span>\default
<span class=
"s4"> );
</span></p>
235 <p class=
"p7"><span class=
"Apple-tab-span"> </span>q.play;
</p>
236 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
237 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>//Pfset(function, pattern)
<span class=
"Apple-converted-space"> </span></b></p>
238 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span></b>// function constructs an event that is passed to the pattern.asStream
</p>
239 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
240 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s3">Pfset
</span>({ ~freq =
<span class=
"s3">Pseq
</span>([
500,
600,
700],
2).asStream }, q).play;
</p>
241 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
242 <p class=
"p3"><span class=
"s7"><span class=
"Apple-tab-span"> </span></span><b>//Pset(name, valPattern, pattern)
<span class=
"Apple-converted-space"> </span></b></p>
243 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span></b>// set one field of the event on an event by event basis (
<b>Pmul
</b>,
<b>Padd
</b> are similar)
</p>
244 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
245 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s3">Pset
</span>(
<span class=
"s5">\freq
</span>,
<span class=
"s3">Pseq
</span>([
500,
600,
700],
2), q).play;
</p>
246 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
247 <p class=
"p3"><span class=
"s7"><span class=
"Apple-tab-span"> </span></span><b>//Psetp(name, valPattern, pattern)
<span class=
"Apple-converted-space"> </span></b></p>
248 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span></b>// set once for each iteration of the pattern (
<b>Pmulp
</b>,
<b>Paddp
</b> are similar)
</p>
249 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
250 <p class=
"p7"><span class=
"Apple-tab-span"> </span>r =
<span class=
"s3">Pset
</span>(
<span class=
"s5">\freq
</span>,
<span class=
"s3">Pseq
</span>([
500,
600,
700],
2), q);
</p>
251 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
252 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s3">Psetp
</span>(
<span class=
"s5">\legato
</span>,
<span class=
"s3">Pseq
</span>([
0.01,
1.1],
<span class=
"s3">inf
</span>), r).play;
</p>
253 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
254 <p class=
"p3"><span class=
"s7"><span class=
"Apple-tab-span"> </span></span><b>//Psetpre(name, valPattern, pattern)
<span class=
"Apple-converted-space"> </span></b></p>
255 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span></b>// set before passing the event to the pattern (
<b>Pmulpre
</b>,
<b>Paddpre
</b> are similar)
</p>
256 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
257 <p class=
"p7"><span class=
"Apple-tab-span"> </span>r =
<span class=
"s3">Psetpre
</span>(
<span class=
"s5">\freq
</span>,
<span class=
"s3">Pseq
</span>([
500,
600,
700],
2), q);
</p>
258 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
259 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s3">Psetp
</span>(
<span class=
"s5">\legato
</span>,
<span class=
"s3">Pseq
</span>([
0.01,
1.1],
<span class=
"s3">inf
</span>), r).play;
</p>
260 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
261 <p class=
"p3"><span class=
"s7"><span class=
"Apple-tab-span"> </span></span><b>//Pstretch(valPattern, pattern)
<span class=
"Apple-converted-space"> </span></b></p>
262 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span></b>// stretches durations after
<span class=
"Apple-converted-space"> </span></p>
263 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
264 <p class=
"p7"><span class=
"Apple-tab-span"> </span>r =
<span class=
"s3">Psetpre
</span>(
<span class=
"s5">\freq
</span>,
<span class=
"s3">Pseq
</span>([
500,
600,
700],
2), q);
</p>
265 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
266 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s3">Pstretch
</span>(
<span class=
"s3">Pn
</span>(
<span class=
"s3">Env
</span>([
0.5,
2,
0.5], [
10,
10])),
<span class=
"s3">Pn
</span>(r)).play;
</p>
267 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
268 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s3">Pset
</span>(
<span class=
"s5">\stretch
</span>,
<span class=
"s3">Pn
</span>(
<span class=
"s3">Env
</span>([
0.5,
2,
0.5], [
10,
10]) ),
<span class=
"s3">Pn
</span>(r)).play
</p>
269 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
270 <p class=
"p3"><span class=
"s7"><span class=
"Apple-tab-span"> </span></span><b>//Pstretchp(valPattern, pattern)
<span class=
"Apple-converted-space"> </span></b></p>
271 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span></b>// stretches durations after
<span class=
"Apple-converted-space"> </span></p>
272 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
273 <p class=
"p7"><span class=
"Apple-tab-span"> </span>r =
<span class=
"s3">Psetpre
</span>(
<span class=
"s5">\freq
</span>,
<span class=
"s3">Pseq
</span>([
500,
600,
700],
2), q);
</p>
274 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
275 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s3">Pstretchp
</span>(
<span class=
"s3">Pn
</span>(
<span class=
"s3">Env
</span>([
0.5,
2,
0.5], [
10,
10])), r).play;
</p>
276 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
277 <p class=
"p3"><span class=
"s7"><span class=
"Apple-tab-span"> </span></span><b>// Pfindur( duration, pattern ) - play pattern for duration
</b></p>
278 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
279 <p class=
"p7"><span class=
"s6"><b><span class=
"Apple-tab-span"> </span></b></span><span class=
"s3">Pfindur
</span>(
2,
<span class=
"s3">Pn
</span>(q,
<span class=
"s3">inf
</span>)).play;
</p>
280 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
281 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>// PfadeIn(
<span class=
"Apple-converted-space"> </span>pattern, fadeTime, holdTime, tolerance )
</b></p>
282 <p class=
"p7"><span class=
"s6"><b><span class=
"Apple-tab-span"> </span></b></span><span class=
"s3">PfadeIn
</span>(
<span class=
"s3">Pn
</span>(q),
3,
0).play(quant:
0);
</p>
283 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
284 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>// PfadeOut(
<span class=
"Apple-converted-space"> </span>pattern, fadeTime, holdTime, tolerance )
</b></p>
285 <p class=
"p7"><span class=
"s6"><b><span class=
"Apple-tab-span"> </span></b></span><span class=
"s3">PfadeOut
</span>(
<span class=
"s3">Pn
</span>(q),
3,
0).play(quant:
0);
</p>
286 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
287 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>// Psync( pattern, quantization, dur, tolerance )
</b></p>
288 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>// pattern is played for dur seconds (within tolerance), then a rest is played so the next pattern
</b></p>
289 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
290 <p class=
"p13"><span class=
"s8"><b><span class=
"Apple-tab-span"> </span></b></span>Pn
<span class=
"s4">(
</span>Psync
<span class=
"s4">(
</span></p>
291 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">Pbind
</span>(
<span class=
"Apple-tab-span"> </span><span class=
"s5">\dur
</span>,
<span class=
"s3">Pwhite
</span>(
0.2,
0.5).round(
0.2),
<span class=
"Apple-converted-space"> </span></p>
292 <p class=
"p7"><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=
"s5">\db
</span>,
<span class=
"s3">Pseq
</span>([-
10, -
15, -
15, -
15, -
15, -
15, -
30])
</p>
293 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>),
2,
3</p>
294 <p class=
"p7"><span class=
"Apple-tab-span"> </span>)).play
</p>
295 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
296 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>//Plag(duration, pattern)
</b></p>
297 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
298 <p class=
"p7"><span class=
"s6"><b><span class=
"Apple-tab-span"> </span></b></span><span class=
"s3">Ppar
</span>([
<span class=
"s3">Plag
</span>(
1.2,
<span class=
"s3">Pn
</span>(p,
4)),
<span class=
"s3">Pn
</span>(
<span class=
"s3">Pbindf
</span>(q,
<span class=
"s5">\ctranspose
</span>, -
24),
5)]).play
</p>
299 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
300 <p class=
"p3"><b>// GENERAL PATTERNS that work with both event and value streams
</b></p>
301 <p class=
"p2"><br></p>
302 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>//Ptrace(pattern, key, printStream)
<span class=
"Apple-converted-space"> </span>- print the contents of a pattern
</b></p>
303 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
304 <p class=
"p7"><span class=
"Apple-tab-span"> </span>r =
<span class=
"s3">Psetpre
</span>(
<span class=
"s5">\freq
</span>,
<span class=
"s3">Pseq
</span>([
500,
600,
700],
2), q);
</p>
305 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
306 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s3">Ptrace
</span>(r).play;
</p>
307 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s3">Ptrace
</span>(r,
<span class=
"s5">\freq
</span>).play;
</p>
308 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
309 <p class=
"p7"><span class=
"Apple-tab-span"> </span>(
</p>
310 <p class=
"p7"><span class=
"Apple-tab-span"> </span>{
<span class=
"s3">var
</span> printStream;
</p>
311 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>printStream =
<span class=
"s3">CollStream
</span>.new;
</p>
312 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">Pseq
</span>([
<span class=
"s3">Ptrace
</span>(r,
<span class=
"s5">\freq
</span>, printStream),
<span class=
"s3">Pfunc
</span>({printStream.collection.dump;
<span class=
"s3">nil
</span> }) ]).play;
</p>
313 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
314 <p class=
"p7"><span class=
"Apple-tab-span"> </span>}.value;
</p>
315 <p class=
"p7"><span class=
"Apple-tab-span"> </span>)
<span class=
"Apple-tab-span"> </span></p>
316 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
317 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>//Pseed(seed, pattern) - set the seed of the random number generator
<span class=
"Apple-converted-space"> </span></b></p>
318 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>// to force repetion of pseudo-random patterns
</b></p>
319 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
320 <p class=
"p7"><span class=
"s6"><b><span class=
"Apple-tab-span"> </span></b></span><span class=
"s3">Pn
</span>(
<span class=
"s3">Pseed
</span>(
44,
<span class=
"s3">Pbindf
</span>(q,
<span class=
"s5">\ctranspose
</span>,
<span class=
"s3">Pbrown
</span>(-
3.0,
3.0,
10) ) ) ).play;
</p>
321 <p class=
"p2"><br></p>
322 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>//Proutine(function) - on exit, the function must return the last value returned by yield
</b></p>
323 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>// (otherwise, the pattern cannot be reliably manipulated by other patterns)
</b></p>
324 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
325 <p class=
"p7"><span class=
"s6"><b><span class=
"Apple-tab-span"> </span></b></span><span class=
"s3">Proutine
</span>({
<span class=
"s3">arg
</span> inval;
<span class=
"Apple-converted-space"> </span></p>
326 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>inval = p.embedInStream(inval);
</p>
327 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>inval =
<span class=
"s3">Event
</span>.silent(
4).yield;
</p>
328 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>inval = q.embedInStream(inval);
</p>
329 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>inval = r.embedInStream(inval);
</p>
330 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>inval;
</p>
331 <p class=
"p7"><span class=
"Apple-tab-span"> </span>}).play
</p>
332 <p class=
"p2"><br></p>
333 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>//Pfunc(function) - the function should not have calls to embedInStream, use Proutine instead.
</b></p>
334 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></p>
335 <p class=
"p7"><span class=
"s6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span><span class=
"s3">Pn
</span>(
<span class=
"s3">Pbindf
</span>(q,
<span class=
"s5">\legato
</span>,
<span class=
"s3">Pfunc
</span>({
<span class=
"s3">arg
</span> inval; if (inval.at(
<span class=
"s5">\degree
</span>)==
5)
<span class=
"Apple-converted-space"> </span>{
4} {
0.2}; })) ).play
</p>
336 <p class=
"p2"><br></p>
337 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>// the following patterns control the sequencing and repetition of other patterns
</b></p>
338 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
339 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>//Pseq(arrayOfPatterns, repeats) - play as a sequence
</b></p>
340 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></p>
341 <p class=
"p7"><span class=
"s6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span><span class=
"s3">Pseq
</span>([
<span class=
"s3">Pseq
</span>([p],
4),
<span class=
"s3">Pseq
</span>([
<span class=
"s3">Pbindf
</span>(q,
<span class=
"s5">\ctranspose
</span>, -
24)],
5)]).play
</p>
342 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
343 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>//Pser(arrayOfPatterns, num) - play num patterns from the arrayOfPatterns
</b></p>
344 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></p>
345 <p class=
"p7"><span class=
"s6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span><span class=
"s3">Pser
</span>([p, q, r],
5).play
</p>
346 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
347 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>//Place(arrayOfPatterns, repeats) - similar to Pseq
</b></p>
348 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>// but array elements that are themselves arrays are iterated
<span class=
"Apple-converted-space"> </span></b></p>
349 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>// embedding the first element on the first repetition, second on the second, etc
</b></p>
350 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></p>
351 <p class=
"p7"><span class=
"s6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span><span class=
"s3">Place
</span>([[p, q, r], q, r],
5).play
</p>
352 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
353 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
354 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>// Pn( pattern, patternRepetitions ) - repeat the pattern n times
</b></p>
355 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></p>
356 <p class=
"p7"><span class=
"s6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span><span class=
"s3">Pn
</span>(p,
2).play;
</p>
357 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
358 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>// Pfin( eventcount, pattern ) - play n events from the pattern
</b></p>
359 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></p>
360 <p class=
"p7"><span class=
"s6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span><span class=
"s3">Pfin
</span>(
12,
<span class=
"s3">Pn
</span>(p,
<span class=
"s3">inf
</span>)).play;
</p>
361 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
362 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>// Pstutter( eventRepetitions, pattern ) - repeat each event from the pattern n times
</b></p>
363 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></p>
364 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">Pstutter
</span>(
4, q).play
</p>
365 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></p>
366 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>//Pwhile(function, pattern)
<span class=
"Apple-converted-space"> </span></b></p>
367 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></p>
368 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">Pwhile
</span>({coin(
0.5).postln;}, q).play
</p>
369 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
370 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>// Pswitch( patternList, selectPattern ) - when a pattern ends, switch according to select
</b></p>
371 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></p>
372 <p class=
"p7"><span class=
"s6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span><span class=
"s3">Pswitch
</span>([p, q, r],
<span class=
"s3">Pwhite
</span>(
0,
100)).play
</p>
373 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
374 <p class=
"p3"><span class=
"s7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><b>// Pswitch1( patternList, selectPattern ) - on each event switch according to select
</b></p>
375 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></p>
376 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">Pn
</span>(
<span class=
"s3">Pswitch1
</span>([p, q, r],
<span class=
"s3">Pwhite
</span>(
0,
2))).play
</p>
377 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
378 <p class=
"p3"><span class=
"s7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><b>// Prand( patternList, repeats ) -
<span class=
"Apple-converted-space"> </span>random selection from list
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></p>
379 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">Prand
</span>([p, q, r],
<span class=
"Apple-converted-space"> </span><span class=
"s3">inf
</span>).play
</p>
380 <p class=
"p9"><br></p>
381 <p class=
"p3"><span class=
"s7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><b>// Pxrand( patternList, repeats ) -
<span class=
"Apple-converted-space"> </span>random selection from list without repeats
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></p>
382 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">Pxrand
</span>([p, q, r],
<span class=
"Apple-converted-space"> </span><span class=
"s3">inf
</span>).play
</p>
383 <p class=
"p9"><br></p>
384 <p class=
"p3"><span class=
"s7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><b>// Pwrand( patternList, weights, repeats ) - weighted random selection from list
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></p>
385 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">Pwrand
</span>([p, q, r], #[
1,
3,
5].normalizeSum,
<span class=
"s3">inf
</span>).play
</p>
386 <p class=
"p9"><br></p>
387 <p class=
"p3"><span class=
"s7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><b>// Pwalk( patternList, stepPattern, directionPattern ) - walk through a list of patterns
</b></p>
388 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></p>
389 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">Pwalk
</span>([p, q, r],
1,
<span class=
"s3">Pseq
</span>([-
1,
1],
<span class=
"s3">inf
</span>)).play
</p>
390 <p class=
"p9"><br></p>
391 <p class=
"p3"><span class=
"s7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><b>// Pslide(list, repeats, length, step, start)
</b></p>
392 <p class=
"p2"><br></p>
393 <p class=
"p7"><span class=
"s6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span><span class=
"s3">Pbind
</span>(
<span class=
"s5">\degree
</span>,
<span class=
"s3">Pslide
</span>(#[
1,
2,
3,
4,
5],
<span class=
"s3">inf
</span>,
3,
1,
0),
<span class=
"s5">\dur
</span>,
0.2).play
</p>
394 <p class=
"p2"><br></p>
395 <p class=
"p3"><span class=
"s7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><b>// Pshuf( patternList, repeats ) -
<span class=
"Apple-converted-space"> </span>random selection from list
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></p>
396 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">Pn
</span>(
<span class=
"s3">Pshuf
</span>([p, q, r, r, p])).play
</p>
397 <p class=
"p9"><br></p>
398 <p class=
"p3"><span class=
"s7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><b>// Ptuple(list, repeats)
</b></p>
399 <p class=
"p2"><br></p>
400 <p class=
"p7"><span class=
"s6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span><span class=
"s3">Pbind
</span>(
<span class=
"s5">\degree
</span>,
<span class=
"s3">Ptuple
</span>([
<span class=
"s3">Pwhite
</span>(
1, -
6),
<span class=
"s3">Pbrown
</span>(
8,
15,
2)]),
<span class=
"Apple-converted-space"> </span></p>
401 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s5">\dur
</span>,
<span class=
"s3">Pfunc
</span>({
<span class=
"s3">arg
</span> ev; ev.at(
<span class=
"s5">\degree
</span>).last/
80 round:
0.1}),
<span class=
"Apple-converted-space"> </span></p>
402 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s5">\db
</span>,
<span class=
"s3">Pfunc
</span>({ if (coin(
0.8)) {-
25} {-
20} })
</p>
403 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>).play
</p>
404 <p class=
"p2"><br></p>
405 <p class=
"p2"><br></p>
406 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>// the following patterns can alter the values returned by other patterns
</b></p>
407 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
408 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>//Pcollect(function, pattern)
<span class=
"Apple-converted-space"> </span></b></p>
409 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></p>
410 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">Pcollect
</span>({
<span class=
"s3">arg
</span> inval; inval.use({ ~freq =
1000.rand }); inval}, q).play
</p>
411 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
412 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>//Pselect(function, pattern)
<span class=
"Apple-converted-space"> </span></b></p>
413 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></p>
414 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">Pselect
</span>({
<span class=
"s3">arg
</span> inval; inval.at(
<span class=
"s5">\degree
</span>) !=
0 }, q).play(quant:
0)
</p>
415 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
416 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>//Preject(function, pattern)
<span class=
"Apple-converted-space"> </span></b></p>
417 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></p>
418 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">Preject
</span>({
<span class=
"s3">arg
</span> inval; inval.at(
<span class=
"s5">\degree
</span>) !=
0 }, q).play(quant:
0)
</p>
419 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
420 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>//Ppatmod(pattern, function, repeats) -
</b></p>
421 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>// function receives the current pattern as an argument and returns the next pattern to be played
</b></p>
422 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
423 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s3">Ppatmod
</span>(p, {
<span class=
"s3">arg
</span> oldPat; [p, q, r].choose },
<span class=
"s3">inf
</span>).play
</p>
424 <p class=
"p2"><br></p>
425 <p class=
"p3"><b>// VALUE PATTERNS: these patterns define or act on streams of numbers
</b></p>
426 <p class=
"p2"><br></p>
427 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>// Env as a pattern
</b></p>
428 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
429 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s3">Pbindf
</span>(
<span class=
"s3">Pn
</span>(q,
<span class=
"s3">inf
</span>),
<span class=
"s5">\ctranspose
</span>,
<span class=
"s3">Pn
</span>(
<span class=
"s3">Env
</span>.linen(
3,
0,
0.3,
20),
<span class=
"s3">inf
</span>) ).play;
</p>
430 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
431 <p class=
"p3"><span class=
"s7"><span class=
"Apple-tab-span"> </span></span><b>// Pwhite(lo, hi, length)
</b></p>
432 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
433 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s3">Pbindf
</span>(
<span class=
"s3">Pn
</span>(q,
<span class=
"s3">inf
</span>),
<span class=
"s5">\ctranspose
</span>,
<span class=
"s3">Pwhite
</span>(-
3.0,
3.0) ).play;
</p>
434 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
435 <p class=
"p3"><span class=
"s7"><span class=
"Apple-tab-span"> </span></span><b>// Pbrown(lo, hi, step, length)
</b></p>
436 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
437 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s3">Pbindf
</span>(
<span class=
"s3">Pn
</span>(q,
<span class=
"s3">inf
</span>),
<span class=
"s5">\ctranspose
</span>,
<span class=
"s3">Pbrown
</span>(-
3.0,
3.0,
2) ).play;
</p>
438 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
439 <p class=
"p3"><span class=
"s7"><span class=
"Apple-tab-span"> </span></span><b>// Pseries(start, step, length)
</b></p>
440 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
441 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s3">Pbindf
</span>(
<span class=
"s3">Pn
</span>(q,
<span class=
"s3">inf
</span>),
<span class=
"s5">\ctranspose
</span>,
<span class=
"s3">Pseries
</span>(
0,
0.1,
10) ).play;
</p>
442 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
443 <p class=
"p3"><span class=
"s7"><span class=
"Apple-tab-span"> </span></span><b>// Pgeom(start, step, length)
</b></p>
444 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
445 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s3">Pbindf
</span>(
<span class=
"s3">Pn
</span>(q,
<span class=
"s3">inf
</span>),
<span class=
"s5">\ctranspose
</span>,
<span class=
"s3">Pgeom
</span>(
1,
1.2,
20) ).play;
</p>
446 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
447 <p class=
"p3"><span class=
"s7"><span class=
"Apple-tab-span"> </span></span><b>// Pwrap(pattern, lo, hi)
</b></p>
448 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
449 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s3">Pbind
</span>(
<span class=
"s5">\note
</span>,
<span class=
"s3">Pwrap
</span>(
<span class=
"s3">Pwhite
</span>(
0,
128),
10,
20).round(
2),
<span class=
"s5">\dur
</span>,
0.05).play;
</p>
450 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
451 <p class=
"p3"><span class=
"s7"><span class=
"Apple-tab-span"> </span></span><b>// PdegreeToKey(pattern, scale, stepsPerOctave)
</b></p>
452 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>// this reimplements part of pitchEvent (see Event)
</b></p>
453 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
454 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s3">Pbindf
</span>(
<span class=
"s3">Pn
</span>(q,
<span class=
"s3">inf
</span>),
<span class=
"s5">\note
</span>,
<span class=
"s3">PdegreeToKey
</span>(
<span class=
"s3">Pbrown
</span>(-
8,
8,
2), [
0,
2,
4,
5,
7,
9,
11]) ).play;
</p>
455 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
456 <p class=
"p3"><span class=
"s7"><span class=
"Apple-tab-span"> </span></span><b>// Prewrite(pattern, dict, levels) - see help page for details.
</b></p>
457 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>// (notice use of Env to define a chord progression of sorts...
</b></p>
458 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
459 <p class=
"p12"><span class=
"s4"><span class=
"Apple-tab-span"> </span></span><span class=
"s3">Pbind
</span><span class=
"s4">(
</span>\degree
<span class=
"s4">,
<span class=
"Apple-converted-space"> </span></span></p>
460 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">Prewrite
</span>(
0,
<span class=
"Apple-tab-span"> </span>(
<span class=
"Apple-tab-span"> </span>0: #[
2,
0],
<span class=
"Apple-converted-space"> </span></p>
461 <p class=
"p7"><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><span class=
"Apple-tab-span"> </span>1: #[
0,
0,
1],
<span class=
"Apple-converted-space"> </span></p>
462 <p class=
"p7"><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><span class=
"Apple-tab-span"> </span>2: #[
1,
0,
1]
</p>
463 <p class=
"p7"><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>),
4</p>
464 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>) +
<span class=
"s3">Pn
</span>(
<span class=
"s3">Env
</span>([
4,
0,
1,
4,
3,
4], [
6.4,
6.4,
6.4,
6.4,
6.4],
<span class=
"s5">'step'
</span>)),
<span class=
"Apple-converted-space"> </span></p>
465 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s5">\dur
</span>,
0.2).play
</p>
466 <p class=
"p9"><br></p>
467 <p class=
"p3"><span class=
"s7"><span class=
"Apple-tab-span"> </span></span><b>// PdurStutter( repetitionPattern, patternOfDurations ) -
<span class=
"Apple-converted-space"> </span></b></p>
468 <p class=
"p13"><span class=
"s8"><b><span class=
"Apple-tab-span"> </span></b></span>Pbindf
<span class=
"s4">(
</span>Pn
<span class=
"s4">(q),
</span><span class=
"s5">\dur
</span><span class=
"s4">,
</span>PdurStutter
<span class=
"s4">(
</span></p>
469 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">Pseq
</span>(#[
1,
1,
1,
1,
1,
2,
2,
2,
2,
2,
3,
4,
5,
7,
15],
<span class=
"s3">inf
</span>),
<span class=
"Apple-converted-space"> </span></p>
470 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">Pseq
</span>(#[
0.5],
<span class=
"s3">inf
</span>)
</p>
471 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
472 <p class=
"p7"><span class=
"Apple-tab-span"> </span>).play;
</p>
473 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
474 <p class=
"p2"><br></p>
475 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>// Pstep2add( pat1, pat2 )
<span class=
"Apple-converted-space"> </span></b></p>
476 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>// Pstep3add( pat1, pat2, pat3 )
<span class=
"Apple-converted-space"> </span></b></p>
477 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>// PstepNadd(pat1, pat2, ...)
<span class=
"Apple-converted-space"> </span></b></p>
478 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>// PstepNfunc(function, patternArray )
</b></p>
479 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>// combine multiple patterns with depth first traversal
</b></p>
480 <p class=
"p2"><br></p>
481 <p class=
"p13"><span class=
"s8"><b><span class=
"Apple-tab-span"> </span></b></span>Pbind
<span class=
"s4">(
</span></p>
482 <p class=
"p12"><span class=
"s4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>\octave
<span class=
"s4">,
4,
<span class=
"Apple-converted-space"> </span></span></p>
483 <p class=
"p13"><span class=
"s4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s5">\degree
</span><span class=
"s4">,
</span>PstepNadd
<span class=
"s4">(
</span></p>
484 <p class=
"p7"><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><span class=
"s3">Pseq
</span>([
1,
2,
3]),
<span class=
"Apple-converted-space"> </span></p>
485 <p class=
"p7"><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><span class=
"s3">Pseq
</span>([
0, -
2, [
1,
3], -
5]),
<span class=
"Apple-converted-space"> </span></p>
486 <p class=
"p7"><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><span class=
"s3">Pshuf
</span>([
1,
0,
3,
0],
2)
</p>
487 <p class=
"p7"><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-converted-space"> </span></p>
488 <p class=
"p13"><span class=
"s4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s5">\dur
</span><span class=
"s4">,
</span>PstepNadd
<span class=
"s4">(
</span></p>
489 <p class=
"p7"><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><span class=
"s3">Pseq
</span>([
1,
0,
0,
1],
2),
<span class=
"Apple-converted-space"> </span></p>
490 <p class=
"p7"><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><span class=
"s3">Pshuf
</span>([
1,
1,
2,
1],
2)
</p>
491 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>).loop * (
1/
8),
<span class=
"Apple-converted-space"> </span></p>
492 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s5">\legato
</span>,
<span class=
"s3">Pn
</span>(
<span class=
"s3">Pshuf
</span>([
0.2,
0.2,
0.2,
0.5,
0.5,
1.6,
1.4],
4),
<span class=
"s3">inf
</span>),
<span class=
"Apple-converted-space"> </span></p>
493 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s5">\scale
</span>, #[
0,
1,
3,
4,
5,
7,
8]
</p>
494 <p class=
"p7"><span class=
"Apple-tab-span"> </span>).play;
</p>
495 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
496 <p class=
"p5"><br></p>
497 <p class=
"p2"><br></p>