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.44">
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: 9.0px Monaco
; min-height: 12.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: 12.0px Helvetica
; min-height: 14.0px}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
}
15 p
.p6
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #ad1d13}
16 p
.p7
{margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica
}
17 p
.p8
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #2b6f11}
18 p
.p9
{margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica
; min-height: 17.0px}
19 p
.p10
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #0019ba}
20 p
.p11
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #7a3827; min-height: 12.0px}
21 p
.p12
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #606060}
22 p
.p13
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #0019ba; min-height: 12.0px}
23 p
.p14
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #bf0000}
24 p
.p15
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #000000}
25 p
.p16
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #0000bf}
26 span
.s1
{color: #0f3ed7}
27 span
.s2
{color: #0019ba}
28 span
.s3
{color: #000000}
29 span
.s4
{color: #2b6f11}
30 span
.s5
{text-decoration: underline
}
31 span
.s6
{color: #606060}
32 span
.s7
{color: #ad1d13}
33 span
.s8
{color: #007300}
34 span
.s9
{color: #0000bf}
35 span
.Apple-tab-span
{white-space:pre
}
39 <p class=
"p1"><b>Scale
</b></p>
40 <p class=
"p2"><br></p>
41 <p class=
"p3"><b>Inherits from:
</b><a href=
"../Core/Object.html"><span class=
"s1"><b>Object
</b></span></a><b><span class=
"Apple-converted-space"> </span></b></p>
42 <p class=
"p2"><br></p>
43 <p class=
"p3">Represents a musical scale. It supports arbitrary octave divisions and ratios, and (in conjunction with
<a href=
"Tuning.html"><span class=
"s1"><b>Tuning
</b></span></a><b> </b>) can generate pitch information in various ways, including as input to Patterns.
</p>
44 <p class=
"p4"><br></p>
45 <p class=
"p5">s.boot;
</p>
46 <p class=
"p4"><br></p>
47 <p class=
"p5">a =
<span class=
"s2">Scale
</span>.major;
</p>
48 <p class=
"p6"><span class=
"s3">a.degrees;
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// [
0,
2,
4,
5,
7,
9,
11 ]
</p>
49 <p class=
"p6"><span class=
"s3">a.semitones;
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// [
0,
2,
4,
5,
7,
9,
11 ]
</p>
50 <p class=
"p6"><span class=
"s3">a.cents;
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// [
0,
200,
300,
500,
700,
900,
1100 ]
</p>
51 <p class=
"p6"><span class=
"s3">a.ratios;
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// [
1,
1.1224620483089,
1.2599210498937,
1.3348398541685, etc. ]
</p>
52 <p class=
"p2"><br></p>
53 <p class=
"p5"><span class=
"s2">Pbind
</span>(
<span class=
"s4">\scale
</span>, a,
<span class=
"s4">\degree
</span>,
<span class=
"s2">Pseq
</span>((
0.
.7) ++ (
6.
.0) ++ [
<span class=
"s4">\rest
</span>],
1),
<span class=
"s4">\dur
</span>,
0.25).play;
</p>
54 <p class=
"p2"><br></p>
55 <p class=
"p6">// use non-standard tuning
</p>
56 <p class=
"p5">a.tuning_(
<span class=
"s4">\just
</span>);
</p>
57 <p class=
"p6"><span class=
"s3">a.degrees;
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// no change; degrees are independent of tuning
</p>
58 <p class=
"p6"><span class=
"s3">a.semitones;
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// [
0,
2.0391000173077,
3.1564128700055,
4.9804499913461, etc. ]
</p>
59 <p class=
"p6"><span class=
"s3">a.ratios.collect(
</span><span class=
"s2">_
</span><span class=
"s3">.round(
0.001));
<span class=
"Apple-tab-span"> </span></span>// [
1,
1.125,
1.2,
1.333,
1.5,
1.667,
1.875 ]
</p>
60 <p class=
"p2"><br></p>
61 <p class=
"p5"><span class=
"s2">Pbind
</span>(
<span class=
"s4">\scale
</span>, a,
<span class=
"s4">\degree
</span>,
<span class=
"s2">Pseq
</span>((
0.
.7) ++ (
6.
.0) ++ [
<span class=
"s4">\rest
</span>],
1),
<span class=
"s4">\dur
</span>,
0.25).play;
</p>
62 <p class=
"p2"><br></p>
63 <p class=
"p2"><br></p>
64 <p class=
"p7"><b><span class=
"s5">Creation
</span></b></p>
65 <p class=
"p2"><br></p>
66 <p class=
"p3"><b>*major, *minor, *dorian, *chromatic, *todi, *hijaz, *partch_o1, etc.
</b></p>
67 <p class=
"p4"><br></p>
68 <p class=
"p3">Creates a scale from the library stored in
<b>ScaleInfo
</b>. Each scale comes with an appropriate default
<b>Tuning
</b>, but alternate tunings can be specified at creation time:
</p>
69 <p class=
"p4"><br></p>
70 <p class=
"p8"><span class=
"s2">Scale
</span><span class=
"s3">.phrygian(
</span>\pythagorean
<span class=
"s3">)
</span></p>
71 <p class=
"p4"><br></p>
72 <p class=
"p3">If the tuning size does not match the scale's
<b>pitchesPerOctave
</b>, a warning will be thrown, and the scale will use its default tuning.
</p>
73 <p class=
"p4"><br></p>
74 <p class=
"p3">For a complete list of available scales, execute
</p>
75 <p class=
"p4"><br></p>
76 <p class=
"p5"><span class=
"s2">Scale
</span>.directory
</p>
77 <p class=
"p4"><br></p>
78 <p class=
"p3"><b>*choose(size, pitchesPerOctave)
</b></p>
79 <p class=
"p4"><br></p>
80 <p class=
"p3">Creates a random scale from the library, constrained by size and pitchsPerOctave if desired.
</p>
81 <p class=
"p4"><br></p>
82 <p class=
"p6"><span class=
"s2">Scale
</span><span class=
"s3">.choose;
<span class=
"Apple-converted-space"> <span class=
"Apple-tab-span"> </span> </span></span>// could be anything
</p>
83 <p class=
"p6"><span class=
"s2">Scale
</span><span class=
"s3">.choose(
7);
<span class=
"Apple-converted-space"> </span></span>// will be a seven-note scale in its default tuning (could be any)
</p>
84 <p class=
"p6"><span class=
"s2">Scale
</span><span class=
"s3">.choose(
7,
12);
</span>// will be a seven-note scale in a twelve-tone tuning (usually ET!
2)
</p>
85 <p class=
"p2"><br></p>
86 <p class=
"p6">// Random seven-note scale in random twelve-tone tuning
</p>
87 <p class=
"p5">a =
<span class=
"s2">Scale
</span>.choose(
7,
12).tuning_(
<span class=
"s2">Tuning
</span>.choose(
12));
<span class=
"Apple-tab-span"> </span></p>
88 <p class=
"p5">a.tuning.name;
</p>
89 <p class=
"p2"><br></p>
90 <p class=
"p3"><b>*new(degrees, pitchesPerOctave, descDegrees, tuning, name)
</b></p>
91 <p class=
"p4"><br></p>
92 <p class=
"p3">Creates a
<b>Scale
</b> from scratch.
<b>degrees
</b> should be an array of Integers or scale name. If
<b>pitchesPerOctave
</b> is nil, will guess the most appropriate number based on degrees.
<b>tuning
</b> can be an instance of
<b>Tuning
</b> or a symbol; if nil, will be equal temperament of pitchesPerOctave. Specify
<b>descDegrees
</b> if the Scale should play differently when descending than when ascending; otherwise it should be nil.
</p>
93 <p class=
"p4"><br></p>
94 <p class=
"p5"><span class=
"s2">Scale
</span>.new(#[
0,
1,
3,
6,
8,
10,
11], name:
<span class=
"s6">"My ET12"</span>);
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s7">// will be in ET12
</span></p>
95 <p class=
"p5"><span class=
"s2">Scale
</span>.new(#[
0,
3,
7,
10,
15,
19,
22], name:
<span class=
"s6">"My Quarter-Tone"</span>);
<span class=
"Apple-converted-space"> </span><span class=
"s7">// will be in ET24
</span></p>
96 <p class=
"p5"><span class=
"s2">Scale
</span>.new(#[
0,
6,
17,
21,
30,
39],
43,
<span class=
"s4">\partch
</span>,
<span class=
"s6">"My Partch"</span>);
</p>
97 <p class=
"p4"><br></p>
98 <p class=
"p2"><br></p>
99 <p class=
"p7"><b><span class=
"s5">Instance Methods
</span></b></p>
100 <p class=
"p9"><br></p>
101 <p class=
"p3"><b>tuning_(tuning)
</b></p>
102 <p class=
"p4"><br></p>
103 <p class=
"p3">Sets the tuning of the Scale.
<b>tuning
</b> argument can be either an instance of
<b>Tuning
</b> or a symbol matching a library tuning.
</p>
104 <p class=
"p4"><br></p>
105 <p class=
"p3"><b>semitones
</b></p>
106 <p class=
"p4"><br></p>
107 <p class=
"p3">Returns a tuned array of semitone values.
<b>as(Array)
</b> is equivalent;
<b>as(List)
</b> returns it as a list, etc.
</p>
108 <p class=
"p4"><br></p>
109 <p class=
"p3"><b>cents
</b></p>
110 <p class=
"p4"><br></p>
111 <p class=
"p3">Returns a tuned array of cent values.
</p>
112 <p class=
"p4"><br></p>
113 <p class=
"p3"><b>ratios
</b></p>
114 <p class=
"p4"><br></p>
115 <p class=
"p3">Returns a tuned array of ratios.
</p>
116 <p class=
"p4"><br></p>
117 <p class=
"p3"><b>as(LocalBuf)
</b></p>
118 <p class=
"p4"><br></p>
119 <p class=
"p3">Useful for server-side work.
</p>
120 <p class=
"p4"><br></p>
122 <p class=
"p5">r = {
</p>
123 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> scale =
<span class=
"s2">Scale
</span>.choose.postln;
</p>
124 <p class=
"p10"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>SinOsc
<span class=
"s3">.ar(
</span></p>
125 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
126 <p class=
"p10"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>DegreeToKey
<span class=
"s3">.kr(
</span></p>
127 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>scale.as(
<span class=
"s2">LocalBuf
</span>),
</p>
128 <p class=
"p6"><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=
"s2">MouseX
</span><span class=
"s3">.kr(
0,
15),
</span>// mouse indexes into scale
</p>
129 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>scale.stepsPerOctave,
</p>
130 <p class=
"p6"><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>1,
</span>// mul =
1</p>
131 <p class=
"p6"><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>60 </span>// offset by
72 notes
</p>
132 <p class=
"p5"><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>
133 <p class=
"p6"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>+
</span><span class=
"s2">LFNoise1
</span><span class=
"s3">.kr([
3,
3],
0.04)
</span>// add some low freq stereo detuning
</p>
134 <p class=
"p6"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>).midicps,
</span>// convert midi notes to hertz
</p>
135 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>0,
</p>
136 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>0.25</p>
137 <p class=
"p5"><span class=
"Apple-tab-span"> </span>)
</p>
138 <p class=
"p5">}.play;
</p>
140 <p class=
"p4"><br></p>
141 <p class=
"p5">r.free;
</p>
142 <p class=
"p4"><br></p>
143 <p class=
"p3"><b>size
</b></p>
144 <p class=
"p4"><br></p>
145 <p class=
"p3">Returns the length of the scale.
</p>
146 <p class=
"p4"><br></p>
147 <p class=
"p5"><span class=
"s2">Scale
</span>.ionian.size;
<span class=
"s7">//
7</span></p>
148 <p class=
"p5"><span class=
"s2">Scale
</span>.minorPentatonic.size;
<span class=
"s7">//
5</span></p>
149 <p class=
"p5"><span class=
"s2">Scale
</span>.ajam.size;
<span class=
"s7">//
7</span></p>
150 <p class=
"p5"><span class=
"s2">Scale
</span>.partch_o1.size;
<span class=
"s7">//
6</span></p>
151 <p class=
"p4"><br></p>
152 <p class=
"p3"><b>pitchesPerOctave
</b></p>
153 <p class=
"p4"><br></p>
154 <p class=
"p3">Returns the size of the pitch class set from which the tuning is drawn.
</p>
155 <p class=
"p4"><br></p>
156 <p class=
"p5"><span class=
"s2">Scale
</span>.ionian.pitchesPerOctave;
<span class=
"s7">//
12</span></p>
157 <p class=
"p5"><span class=
"s2">Scale
</span>.minorPentatonic.pitchesPerOctave;
<span class=
"s7">//
12</span></p>
158 <p class=
"p6"><span class=
"s2">Scale
</span><span class=
"s3">.ajam.pitchesPerOctave;
</span>//
24--this is a quarter-tone scale
</p>
159 <p class=
"p5"><span class=
"s2">Scale
</span>.partch_o1.pitchesPerOctave;
<span class=
"s7">//
43</span></p>
160 <p class=
"p4"><br></p>
161 <p class=
"p3"><b>stepsPerOctave
</b></p>
162 <p class=
"p4"><br></p>
163 <p class=
"p3">Usually
12, but may be different if the current tuning has a stretched or compressed octave. Needed for degreeToKey.
</p>
164 <p class=
"p4"><br></p>
165 <p class=
"p5"><span class=
"s2">Scale
</span>.new((
0.
.14),
15, tuning:
<span class=
"s4">\wcAlpha
</span>).stepsPerOctave;
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s7">// ~
11.7</span></p>
166 <p class=
"p5"><span class=
"s2">Scale
</span>.new(#[
0,
3,
6,
9,
12],
13, tuning:
<span class=
"s4">\bp
</span>).stepsPerOctave;
<span class=
"Apple-converted-space"> <span class=
"Apple-tab-span"> </span></span><span class=
"s7">// ~
19.02</span></p>
167 <p class=
"p4"><br></p>
168 <p class=
"p3">but note:
</p>
169 <p class=
"p4"><br></p>
170 <p class=
"p6"><span class=
"s2">Scale
</span><span class=
"s3">.ajam.stepsPerOctave;
<span class=
"Apple-tab-span"> </span></span>//
12 -- quarter-tone scales have normal octaves
</p>
171 <p class=
"p4"><br></p>
172 <p class=
"p3"><b>at, wrapAt
</b></p>
173 <p class=
"p4"><br></p>
174 <p class=
"p3">These access the array generated by
<b>semitones
</b>.
</p>
175 <p class=
"p2"><br></p>
176 <p class=
"p5">a =
<span class=
"s2">Scale
</span>.major;
</p>
177 <p class=
"p5">a.wrapAt(
4);
<span class=
"Apple-converted-space"> </span><span class=
"s7">//
7</span></p>
178 <p class=
"p5">a.wrapAt(
5);
<span class=
"Apple-converted-space"> </span><span class=
"s7">//
9</span></p>
179 <p class=
"p5">a.wrapAt(
6);
<span class=
"Apple-converted-space"> </span><span class=
"s7">//
11</span></p>
180 <p class=
"p5">a.wrapAt(
7);
<span class=
"Apple-converted-space"> </span><span class=
"s7">//
0</span></p>
181 <p class=
"p2"><br></p>
182 <p class=
"p3"><b>degreeToFreq(degree, rootFreq, octave)
</b></p>
183 <p class=
"p4"><br></p>
184 <p class=
"p3">Returns a frequency based on current tuning and
<b>rootFreq
</b> argument.
</p>
185 <p class=
"p4"><br></p>
186 <p class=
"p5"><span class=
"s2">Scale
</span>.major.degreeToFreq(
2,
60.midicps,
1);
<span class=
"Apple-converted-space"> <span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s7">//
659.25511...
</span></p>
187 <p class=
"p5"><span class=
"s2">Scale
</span>.major(
<span class=
"s4">\just
</span>).degreeToFreq(
2,
60.midicps,
1);
<span class=
"Apple-tab-span"> </span><span class=
"s7">//
654.06391...
</span></p>
188 <p class=
"p4"><br></p>
189 <p class=
"p3"><b>degreeToRatio(degree, octave)
</b></p>
190 <p class=
"p4"><br></p>
191 <p class=
"p3">Returns a ratio based on current tuning.
</p>
192 <p class=
"p4"><br></p>
193 <p class=
"p5"><span class=
"s2">Scale
</span>.major.degreeToRatio(
2,
1).round(
0.001);
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s7">//
2.52</span></p>
194 <p class=
"p5"><span class=
"s2">Scale
</span>.major(
<span class=
"s4">\just
</span>).degreeToRatio(
2,
1).round(
0.001);
<span class=
"Apple-tab-span"> </span><span class=
"s7">//
2.5</span></p>
195 <p class=
"p11"><br></p>
196 <p class=
"p2"><br></p>
197 <p class=
"p7"><b><span class=
"s5">Examples
</span></b></p>
198 <p class=
"p2"><br></p>
200 <p class=
"p5">s.waitForBoot({
</p>
201 <p class=
"p5"><span class=
"Apple-tab-span"> </span>a =
<span class=
"s2">Scale
</span>.ionian;
</p>
202 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
203 <p class=
"p5"><span class=
"Apple-tab-span"> </span>p =
<span class=
"s2">Pbind
</span>(
</p>
204 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">\degree
</span>,
<span class=
"s2">Pseq
</span>([
0,
1,
2,
3,
4,
5,
6,
7,
6,
5,
4,
3,
2,
1,
0,
<span class=
"s4">\rest
</span>],
<span class=
"s2">inf
</span>),
</p>
205 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">\scale
</span>,
<span class=
"s2">Pfunc
</span>({ a },
<span class=
"s2">inf
</span>),
</p>
206 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">\dur
</span>,
0.25</p>
207 <p class=
"p5"><span class=
"Apple-tab-span"> </span>);
</p>
208 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
209 <p class=
"p5"><span class=
"Apple-tab-span"> </span>q = p.play;
</p>
212 <p class=
"p2"><br></p>
213 <p class=
"p6">// change scale
</p>
214 <p class=
"p5">a =
<span class=
"s2">Scale
</span>.phrygian;
</p>
215 <p class=
"p2"><br></p>
216 <p class=
"p6">// change tuning
</p>
217 <p class=
"p5">a.tuning_(
<span class=
"s4">\just
</span>);
</p>
218 <p class=
"p2"><br></p>
219 <p class=
"p6">// can also set tuning at creation time
</p>
220 <p class=
"p5">a =
<span class=
"s2">Scale
</span>.ionian(
<span class=
"s4">\pythagorean
</span>);
</p>
221 <p class=
"p2"><br></p>
222 <p class=
"p6">// if you use a tuning with the wrong number of pitches per octave,
</p>
223 <p class=
"p6">// you get a warning and the scale reverts to default tuning
</p>
224 <p class=
"p5">a.tuning_(
<span class=
"s4">\partch
</span>);
</p>
225 <p class=
"p2"><br></p>
226 <p class=
"p6">// random scale
</p>
228 <p class=
"p5">a =
<span class=
"s2">Scale
</span>.choose(
7,
12);
</p>
229 <p class=
"p5">[a.name, a.tuning.name].postln;
</p>
231 <p class=
"p2"><br></p>
233 <p class=
"p6">// or make up your own arbitrary scales and tunings
</p>
234 <p class=
"p5">a =
<span class=
"s2">Scale
</span>.new(
</p>
235 <p class=
"p5"><span class=
"Apple-tab-span"> </span>#[
0,
2,
4,
5,
7,
9,
10],
</p>
236 <p class=
"p5"><span class=
"Apple-tab-span"> </span>12,
</p>
237 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"s2">Tuning
</span>.new([
0,
0.8,
2.1,
3,
4.05,
5.2,
6,
6.75,
8.3,
9,
10.08,
11.5]),
</p>
238 <p class=
"p12"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>"Custom"<span class=
"s3"><span class=
"Apple-converted-space"> </span></span></p>
241 <p class=
"p2"><br></p>
242 <p class=
"p6">// tuning has its own class
</p>
243 <p class=
"p5">t =
<span class=
"s2">Tuning
</span>.werckmeister;
</p>
244 <p class=
"p2"><br></p>
245 <p class=
"p5">a =
<span class=
"s2">Scale
</span>.lydian(t);
</p>
246 <p class=
"p2"><br></p>
247 <p class=
"p5">q.stop;
</p>
248 <p class=
"p2"><br></p>
249 <p class=
"p6">// getting info
</p>
250 <p class=
"p5">a.name;
</p>
251 <p class=
"p5">a.degrees;
</p>
252 <p class=
"p5">a.semitones;
</p>
253 <p class=
"p5">a.ratios;
<span class=
"Apple-converted-space"> </span></p>
254 <p class=
"p2"><br></p>
255 <p class=
"p5">a.tuning.name;
</p>
256 <p class=
"p5">a.tuning.semitones;
</p>
257 <p class=
"p5">a.tuning.ratios;
</p>
258 <p class=
"p2"><br></p>
259 <p class=
"p6">// cmd-J to see scale and tuning dictionaries in full
</p>
260 <p class=
"p10">ScaleInfo
</p>
261 <p class=
"p10">TuningInfo
</p>
262 <p class=
"p13"><br></p>
263 <p class=
"p14">// for ascending/descending scales, use Pavaroh
</p>
265 <p class=
"p16">Pbind
<span class=
"s3">(
</span><span class=
"s8">\note
</span><span class=
"s3">,
</span>Pavaroh
<span class=
"s3">(
</span></p>
266 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"s9">Pseq
</span>([
0,
1,
2,
3,
4,
5,
6,
7,
6,
5,
4,
3,
2,
1,
0,
<span class=
"s8">\rest
</span>],
2),
</p>
267 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s9">Scale
</span>.melodicMinor,
</p>
268 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s9">Scale
</span>.melodicMinorDesc
</p>
269 <p class=
"p15"><span class=
"Apple-tab-span"> </span>),
</p>
270 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"s8">\dur
</span>,
0.25</p>
271 <p class=
"p15">).play;
</p>