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.42">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
}
11 p
.p2
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; min-height: 14.0px}
12 p
.p3
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 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
; color: #a71e12; min-height: 12.0px}
17 p
.p8
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #a71e12}
18 p
.p9
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco
; min-height: 16.0px}
19 p
.p10
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #606060}
20 p
.p11
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; min-height: 12.0px}
21 p
.p12
{margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Helvetica
}
22 p
.p13
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #0019b7}
23 span
.s1
{font: 18.0px Helvetica
}
24 span
.s2
{color: #0019b7}
25 span
.s3
{color: #326f17}
26 span
.s4
{color: #a71e12}
27 span
.s5
{color: #606060}
28 span
.s6
{color: #000000}
29 span
.Apple-tab-span
{white-space:pre
}
33 <p class=
"p1"><span class=
"s1"><b>Score
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span><b>score of timed OSC commands
</b></p>
34 <p class=
"p2"><br></p>
35 <p class=
"p2"><br></p>
36 <p class=
"p2"><br></p>
37 <p class=
"p1">Score encapsulates a list of timed OSC commands and provides some methods for using it, as well as support for the creation of binary OSC files for non-realtime synthesis. See
<b>Non-Realtime-Synthesis
</b> for more details.
</p>
38 <p class=
"p2"><br></p>
39 <p class=
"p1">The list should be in the following format, with times in ascending order. Bundles are okay.
</p>
40 <p class=
"p2"><br></p>
42 <p class=
"p3">[beat1, [
<span class=
"s2">OSCcmd1
</span>]],
</p>
43 <p class=
"p3">[beat2, [
<span class=
"s2">OSCcmd2
</span>], [
<span class=
"s2">OSCcmd3
</span>]],
</p>
45 <p class=
"p3">[beat_n, [
<span class=
"s2">OSCcmdn
</span>]],
</p>
46 <p class=
"p3">[beatToEndNRT, [
<span class=
"s3">\c_set
</span>,
0,
0]]
<span class=
"s4">// finish
</span></p>
48 <p class=
"p2"><br></p>
49 <p class=
"p1">For NRT synthesis the final event should a dummy event, after which synthesis will cease. It is thus important that this event be timed to allow previous events to complete.
</p>
50 <p class=
"p2"><br></p>
51 <p class=
"p1"><b>Score
</b> scheduling defaults to
<b>TempoClock
</b>. A setting of
<b>TempoClock
</b>.default.tempo =
1 (
60 beats per minute), may be used to express score events in seconds if desired.
</p>
52 <p class=
"p2"><br></p>
53 <p class=
"p2"><br></p>
54 <p class=
"p2"><br></p>
55 <p class=
"p2"><br></p>
56 <p class=
"p4"><b>Class Methods
</b></p>
57 <p class=
"p2"><br></p>
58 <p class=
"p1"><b>*new(list)
</b> - returns a new Score object with the supplied list.
<b>list
</b>can be an
<b>Array
</b>, a
<b>List
</b>, or similar object.
</p>
59 <p class=
"p2"><br></p>
60 <p class=
"p1"><b>*newFromFile(path)
</b>- as
<b>*new
</b>, but reads the list in from a text file.
<b>path
</b>is a string indicating the path of the file. The file must contain a valid SC expression.
</p>
61 <p class=
"p2"><br></p>
62 <p class=
"p1"><b>*play(list, server)
</b>- as
<b>*new
</b> but immediately plays it. (See also the instance method below.) If no value is supplied for
<b>server
</b> it will play on the default
<b>Server
</b>.
</p>
63 <p class=
"p2"><br></p>
64 <p class=
"p1"><b>*playFromFile(path, server)
</b>- as
<b>*play
</b>, but reads the list from a file.
</p>
65 <p class=
"p2"><br></p>
66 <p class=
"p1"><b>*write(list, oscFilePath, clock)
</b> - a convenience method to create a binary OSC file for NRT synthesis. Does not create an instance.
<b>oscFilePath
</b> is a string containing the desired path of the OSC file. Use
<b>clock
</b> as a tempo base.
<b>TempoClock
</b>.default if
<b>clock
</b> is nil.
</p>
67 <p class=
"p2"><br></p>
68 <p class=
"p1"><b>*writeFromFile(path, oscFilePath, clock)
</b> - as *write but reads the list from a file. Use
<b>clock
</b> as a tempo base.
<span class=
"Apple-converted-space"> </span><b>TempoClock
</b>.default if
<b>clock
</b> is nil.
</p>
69 <p class=
"p2"><br></p>
70 <p class=
"p1"><b>*recordNRT(list, oscFilePath, outputFilePath, inputFilePath, sampleRate, headerFormat, sampleFormat, options)
</b> - a convenience method to synthesize
<b>list
</b> in non-realtime. This method writes an OSC file to
<b>oscFilePath
</b> (you have to do your own cleanup if desired) and then starts a server app to synthesize it. For details on valid headerFormats and sampleFormats see
<b>SoundFile
</b>. Use
<b>TempoClock
</b>.default as a tempo base. Does not return an instance.
</p>
71 <p class=
"p1"><b><span class=
"Apple-tab-span"> </span>oscFilePath
</b>- the path to which the binary OSC file will be written.
</p>
72 <p class=
"p1"><span class=
"Apple-tab-span"> </span><b>outputFilePath
</b>- the path of the resultant soundfile.
</p>
73 <p class=
"p1"><b><span class=
"Apple-tab-span"> </span>inputFilePath
</b> - an optional path for an input soundfile.
</p>
74 <p class=
"p1"><span class=
"Apple-tab-span"> </span><b>sampleRate
</b> - the sample rate at which synthesis will occur.
</p>
75 <p class=
"p1"><span class=
"Apple-tab-span"> </span><b>headerFormat
</b> - the header format of the output file. The default is 'AIFF'.
</p>
76 <p class=
"p1"><span class=
"Apple-tab-span"> </span><b>sampleFormat
</b>- the sample format of the output file. The default is 'int16'.
</p>
77 <p class=
"p1"><span class=
"Apple-tab-span"> </span><b>options
</b> - an instance of
<b>ServerOptions
</b>. If not supplied the options of the default
<b>Server
</b> will be used.
</p>
78 <p class=
"p2"><br></p>
79 <p class=
"p4"><b>Instance Methods
</b></p>
80 <p class=
"p5"><br></p>
81 <p class=
"p1"><b>play(server, clock, quant)
</b>- play the list on
<b>server
</b> use
<b>clock
</b> as a tempo base and quantize start time to
<b>quant
</b>. If
<b>server
</b> is nil, then on the default server.
<b>TempoClock
</b>.default if
<b>clock
</b> is nil. now if
<b>quant
</b> is
0.
</p>
82 <p class=
"p2"><br></p>
83 <p class=
"p1"><b>stop
</b>- stop playing.
</p>
84 <p class=
"p2"><br></p>
85 <p class=
"p1"><b>write(oscFilePath, clock)
</b>- create a binary OSC file for NRT synthesis from the list. Use
<b>clock
</b> as a tempo base.
<b>TempoClock
</b>.default if
<b>clock
</b> is nil.
</p>
86 <p class=
"p2"><br></p>
87 <p class=
"p1"><b>score
</b>- get the list.
</p>
88 <p class=
"p2"><br></p>
89 <p class=
"p1"><b>score_(list)
</b>- set the list.
</p>
90 <p class=
"p2"><br></p>
91 <p class=
"p1"><b>add(bundle)
</b> - adds bundle to the list.
</p>
92 <p class=
"p2"><br></p>
93 <p class=
"p1"><b>sort
</b> - sort the score time order.
<span class=
"Apple-converted-space"> </span></p>
94 <p class=
"p1"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>This is recommended to do
<b>before
</b> <b>recordNRT or write
</b> when
<span class=
"Apple-converted-space"> </span></p>
95 <p class=
"p1"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>you are not sure about the packet order
</p>
96 <p class=
"p2"><br></p>
97 <p class=
"p1"><b>recordNRT(oscFilePath, outputFilePath, inputFilePath, sampleRate, headerFormat, sampleFormat, options)
</b> - synthesize the score in non-realtime. For details of the arguments see
<b>*recordNRT
</b> above.
</p>
98 <p class=
"p2"><br></p>
99 <p class=
"p1"><b>saveToFile(path)
</b> - save the score list as a text file to
<b>path.
</b></p>
100 <p class=
"p2"><br></p>
101 <p class=
"p2"><br></p>
102 <p class=
"p2"><br></p>
103 <p class=
"p6"><b>NRT Examples:
</b></p>
104 <p class=
"p7"><br></p>
105 <p class=
"p8">// A sample synthDef
</p>
107 <p class=
"p3"><span class=
"s2">SynthDef
</span>(
<span class=
"s5">"helpscore"</span>,{
<span class=
"s2">arg
</span> freq =
440;
</p>
108 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"s2">Out
</span>.ar(
0,
</p>
109 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span> <span class=
"s2">SinOsc
</span>.ar(freq,
0,
0.2) *
<span class=
"s2">Line
</span>.kr(
1,
0,
0.5, doneAction:
2)
</p>
110 <p class=
"p3"><span class=
"Apple-tab-span"> </span>)
</p>
111 <p class=
"p3">}).load(s);
</p>
113 <p class=
"p9"><br></p>
114 <p class=
"p8">// write a sample file for testing
</p>
116 <p class=
"p3"><span class=
"s2">var
</span> f, g;
</p>
117 <p class=
"p3"><span class=
"s2">TempoClock
</span>.default.tempo =
1;
</p>
118 <p class=
"p3">g = [
</p>
119 <p class=
"p3"><span class=
"Apple-tab-span"> </span>[
0.1, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1000,
0,
0,
<span class=
"s3">\freq
</span>,
440]],
<span class=
"Apple-tab-span"> </span>[
0.2, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1001,
0,
0,
<span class=
"s3">\freq
</span>,
660]],
</p>
120 <p class=
"p3"><span class=
"Apple-tab-span"> </span>[
0.3, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1002,
0,
0,
<span class=
"s3">\freq
</span>,
220]],
</p>
121 <p class=
"p3"><span class=
"Apple-tab-span"> </span>[
1, [
<span class=
"s3">\c_set
</span>,
0,
0]]
<span class=
"s4">// finish
</span></p>
122 <p class=
"p3"><span class=
"Apple-tab-span"> </span>];
</p>
123 <p class=
"p10"><span class=
"s6">f =
</span><span class=
"s2">File
</span><span class=
"s6">(
</span>"score-test"<span class=
"s6">,
</span>"w"<span class=
"s6">);
</span></p>
124 <p class=
"p3">f.write(g.asCompileString);
</p>
125 <p class=
"p3">f.close;
</p>
127 <p class=
"p11"><br></p>
128 <p class=
"p8">//convert it to a binary OSC file for use with NRT
</p>
129 <p class=
"p10"><span class=
"s2">Score
</span><span class=
"s6">.writeFromFile(
</span>"score-test"<span class=
"s6">,
</span>"test.osc"<span class=
"s6">);
</span></p>
130 <p class=
"p11"><br></p>
131 <p class=
"p1">From the command line, the file can then be rendered from within the build directory:
</p>
132 <p class=
"p11"><br></p>
133 <p class=
"p3">./scsynth -N test.osc _ test.aif
44100 AIFF int16 -o
1<span class=
"Apple-converted-space"> </span></p>
134 <p class=
"p11"><br></p>
135 <p class=
"p1">Score also provides methods to do all this more directly:
</p>
136 <p class=
"p11"><br></p>
138 <p class=
"p3"><span class=
"s2">var
</span> f, o;
</p>
139 <p class=
"p3">g = [
</p>
140 <p class=
"p3"><span class=
"Apple-tab-span"> </span>[
0.1, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1000,
0,
0,
<span class=
"s3">\freq
</span>,
440]],
<span class=
"Apple-tab-span"> </span>[
0.2, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1001,
0,
0,
<span class=
"s3">\freq
</span>,
660],
<span class=
"Apple-converted-space"> </span></p>
141 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>[
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1002,
0,
0,
<span class=
"s3">\freq
</span>,
880]],
</p>
142 <p class=
"p3"><span class=
"Apple-tab-span"> </span>[
0.3, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1003,
0,
0,
<span class=
"s3">\freq
</span>,
220]],
</p>
143 <p class=
"p3"><span class=
"Apple-tab-span"> </span>[
1, [
<span class=
"s3">\c_set
</span>,
0,
0]]
<span class=
"s4">// finish
</span></p>
144 <p class=
"p3"><span class=
"Apple-tab-span"> </span>];
</p>
145 <p class=
"p3">o =
<span class=
"s2">ServerOptions
</span>.new.numOutputBusChannels =
1;
<span class=
"s4">// mono output
</span></p>
146 <p class=
"p3"><span class=
"s2">Score
</span>.recordNRT(g,
<span class=
"s5">"help-oscFile"</span>,
<span class=
"s5">"helpNRT.aiff"</span>, options: o);
<span class=
"s4">// synthesize
</span></p>
148 <p class=
"p2"><br></p>
149 <p class=
"p2"><br></p>
150 <p class=
"p2"><br></p>
151 <p class=
"p2"><br></p>
152 <p class=
"p4"><b>Real-time Examples:
</b></p>
153 <p class=
"p9"><br></p>
154 <p class=
"p8"><span class=
"s6">s.boot;
</span>// boot the default server
</p>
155 <p class=
"p7"><br></p>
156 <p class=
"p8">// A sample synthDef
</p>
158 <p class=
"p3"><span class=
"s2">SynthDef
</span>(
<span class=
"s5">"helpscore"</span>,{
<span class=
"s2">arg
</span> freq =
440;
</p>
159 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"s2">Out
</span>.ar(
0,
</p>
160 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span> <span class=
"s2">SinOsc
</span>.ar(freq,
0,
0.2) *
<span class=
"s2">Line
</span>.kr(
1,
0,
0.5, doneAction:
2)
</p>
161 <p class=
"p3"><span class=
"Apple-tab-span"> </span>)
</p>
162 <p class=
"p3">}).load(s);
</p>
164 <p class=
"p9"><br></p>
165 <p class=
"p8">// write a sample file for testing
</p>
167 <p class=
"p3"><span class=
"s2">var
</span> f, g;
</p>
168 <p class=
"p3"><span class=
"s2">TempoClock
</span>.default.tempo =
1;
</p>
169 <p class=
"p3">g = [
</p>
170 <p class=
"p3"><span class=
"Apple-tab-span"> </span>[
0.1, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1000,
0,
0,
<span class=
"s3">\freq
</span>,
440]],
<span class=
"Apple-tab-span"> </span>[
0.2, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1001,
0,
0,
<span class=
"s3">\freq
</span>,
660],
<span class=
"Apple-converted-space"> </span></p>
171 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>[
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1002,
0,
0,
<span class=
"s3">\freq
</span>,
880]],
</p>
172 <p class=
"p3"><span class=
"Apple-tab-span"> </span>[
0.3, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1003,
0,
0,
<span class=
"s3">\freq
</span>,
220]],
</p>
173 <p class=
"p3"><span class=
"Apple-tab-span"> </span>[
1, [
<span class=
"s3">\c_set
</span>,
0,
0]]
<span class=
"s4">// finish
</span></p>
174 <p class=
"p3"><span class=
"Apple-tab-span"> </span>];
</p>
175 <p class=
"p10"><span class=
"s6">f =
</span><span class=
"s2">File
</span><span class=
"s6">(
</span>"score-test"<span class=
"s6">,
</span>"w"<span class=
"s6">);
</span></p>
176 <p class=
"p3">f.write(g.asCompileString);
</p>
177 <p class=
"p3">f.close;
</p>
179 <p class=
"p11"><br></p>
180 <p class=
"p3">z = Score.newFromFile(
<span class=
"s5">"score-test"</span>);
</p>
181 <p class=
"p11"><br></p>
182 <p class=
"p8">// play it on the default server
</p>
183 <p class=
"p3"><span class=
"s2">z
</span>.play;
</p>
184 <p class=
"p11"><br></p>
185 <p class=
"p8">// change the list
</p>
187 <p class=
"p3">x = [
</p>
188 <p class=
"p3">[
0.0, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1000,
0,
0,
<span class=
"Apple-converted-space"> </span><span class=
"s3">\freq
</span>,
1413 ]],
</p>
189 <p class=
"p3">[
0.1, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1001,
0,
0,
<span class=
"Apple-converted-space"> </span><span class=
"s3">\freq
</span>,
712 ]],
</p>
190 <p class=
"p3">[
0.2, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1002,
0,
0,
<span class=
"Apple-converted-space"> </span><span class=
"s3">\freq
</span>,
417 ]],
</p>
191 <p class=
"p3">[
0.3, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1003,
0,
0,
<span class=
"Apple-converted-space"> </span><span class=
"s3">\freq
</span>,
1238 ]],
</p>
192 <p class=
"p3">[
0.4, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1004,
0,
0,
<span class=
"Apple-converted-space"> </span><span class=
"s3">\freq
</span>,
996 ]],
</p>
193 <p class=
"p3">[
0.5, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1005,
0,
0,
<span class=
"Apple-converted-space"> </span><span class=
"s3">\freq
</span>,
1320 ]],
</p>
194 <p class=
"p3">[
0.6, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1006,
0,
0,
<span class=
"Apple-converted-space"> </span><span class=
"s3">\freq
</span>,
864 ]],
</p>
195 <p class=
"p3">[
0.7, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1007,
0,
0,
<span class=
"Apple-converted-space"> </span><span class=
"s3">\freq
</span>,
1033 ]],
</p>
196 <p class=
"p3">[
0.8, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1008,
0,
0,
<span class=
"Apple-converted-space"> </span><span class=
"s3">\freq
</span>,
1693 ]],
</p>
197 <p class=
"p3">[
0.9, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1009,
0,
0,
<span class=
"Apple-converted-space"> </span><span class=
"s3">\freq
</span>,
410 ]],
</p>
198 <p class=
"p3">[
1.0, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1010,
0,
0,
<span class=
"Apple-converted-space"> </span><span class=
"s3">\freq
</span>,
1349 ]],
</p>
199 <p class=
"p3">[
1.1, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1011,
0,
0,
<span class=
"Apple-converted-space"> </span><span class=
"s3">\freq
</span>,
1449 ]],
</p>
200 <p class=
"p3">[
1.2, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1012,
0,
0,
<span class=
"Apple-converted-space"> </span><span class=
"s3">\freq
</span>,
1603 ]],
</p>
201 <p class=
"p3">[
1.3, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1013,
0,
0,
<span class=
"Apple-converted-space"> </span><span class=
"s3">\freq
</span>,
333 ]],
</p>
202 <p class=
"p3">[
1.4, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1014,
0,
0,
<span class=
"Apple-converted-space"> </span><span class=
"s3">\freq
</span>,
678 ]],
</p>
203 <p class=
"p3">[
1.5, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1015,
0,
0,
<span class=
"Apple-converted-space"> </span><span class=
"s3">\freq
</span>,
503 ]],
</p>
204 <p class=
"p3">[
1.6, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1016,
0,
0,
<span class=
"Apple-converted-space"> </span><span class=
"s3">\freq
</span>,
820 ]],
</p>
205 <p class=
"p3">[
1.7, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1017,
0,
0,
<span class=
"Apple-converted-space"> </span><span class=
"s3">\freq
</span>,
1599 ]],
</p>
206 <p class=
"p3">[
1.8, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1018,
0,
0,
<span class=
"Apple-converted-space"> </span><span class=
"s3">\freq
</span>,
968 ]],
</p>
207 <p class=
"p3">[
1.9, [
<span class=
"s3">\s_new
</span>,
<span class=
"s3">\helpscore
</span>,
1019,
0,
0,
<span class=
"Apple-converted-space"> </span><span class=
"s3">\freq
</span>,
1347 ]],
</p>
208 <p class=
"p3">[
2.0, [
<span class=
"s3">\c_set
</span>,
0,
0]]
<span class=
"s4">// finish
</span></p>
210 <p class=
"p11"><br></p>
211 <p class=
"p3">z.score_(x);
</p>
213 <p class=
"p11"><br></p>
214 <p class=
"p8">// play it
</p>
215 <p class=
"p3">z.play;
</p>
216 <p class=
"p11"><br></p>
217 <p class=
"p8">// play and stop after one second
</p>
219 <p class=
"p3">z.play;
</p>
220 <p class=
"p3"><span class=
"s2">SystemClock
</span>.sched(
1.0, {z.stop;});
</p>
222 <p class=
"p11"><br></p>
223 <p class=
"p11"><br></p>
224 <p class=
"p11"><br></p>
225 <p class=
"p11"><br></p>
226 <p class=
"p12"><b>creating Score from a pattern
</b></p>
227 <p class=
"p11"><br></p>
228 <p class=
"p11"><br></p>
229 <p class=
"p13">SynthDescLib
<span class=
"s6">.read;
</span></p>
230 <p class=
"p11"><br></p>
231 <p class=
"p11"><br></p>
232 <p class=
"p8">// new pattern
</p>
234 <p class=
"p3">p =
<span class=
"s2">Pbind
</span>(
</p>
235 <p class=
"p11"><span class=
"Apple-tab-span"> </span></p>
236 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"s3">\dur
</span>,
<span class=
"s2">Prand
</span>([
0.3,
0.5],
<span class=
"s2">inf
</span>),
</p>
237 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"s3">\freq
</span>,
<span class=
"s2">Prand
</span>([
200,
300,
500],
<span class=
"s2">inf
</span>)
</p>
240 <p class=
"p11"><br></p>
241 <p class=
"p8">// make a score from the pattern,
4 beats long
</p>
242 <p class=
"p3">z = p.asScore(
4.0);
</p>
243 <p class=
"p11"><br></p>
244 <p class=
"p3">z.score.postcs;
</p>
245 <p class=
"p3">z.play;
</p>
246 <p class=
"p11"><br></p>
247 <p class=
"p11"><br></p>
248 <p class=
"p11"><br></p>
249 <p class=
"p11"><br></p>
250 <p class=
"p12"><b>rendering a pattern to sound file directly:
</b></p>
251 <p class=
"p11"><br></p>
252 <p class=
"p8">// render the pattern to aiff (
4 beats)
</p>
253 <p class=
"p11"><br></p>
254 <p class=
"p10"><span class=
"s6">p.render(
</span>"asScore-Help.aif"<span class=
"s6">,
4.0);
</span></p>
255 <p class=
"p11"><br></p>
256 <p class=
"p11"><br></p>
257 <p class=
"p11"><br></p>
258 <p class=
"p11"><br></p>
259 <p class=
"p11"><br></p>