supernova: fixes for boost-1.49 and gcc-4.7
[supercollider.git] / Help / Collections / Tuning.html
blobc7116743789777b3b8e01c1c94aa304285e915d0
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta http-equiv="Content-Style-Type" content="text/css">
6 <title></title>
7 <meta name="Generator" content="Cocoa HTML Writer">
8 <meta name="CocoaVersion" content="824.44">
9 <style type="text/css">
10 p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica}
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: #000000}
18 span.s1 {color: #002ce2}
19 span.s2 {color: #0019ba}
20 span.s3 {color: #000000}
21 span.s4 {color: #2b6f11}
22 span.s5 {text-decoration: underline}
23 span.s6 {color: #0000bf}
24 span.Apple-tab-span {white-space:pre}
25 </style>
26 </head>
27 <body>
28 <p class="p1"><b>Tuning</b></p>
29 <p class="p2"><br></p>
30 <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>
31 <p class="p2"><br></p>
32 <p class="p3">Represents a musical tuning (e.g. equal temperament, just intonation, etc.). Used in conjunction with <a href="Scale.html"><span class="s1"><b>Scale</b></span></a> to generate pitch information.</p>
33 <p class="p4"><br></p>
34 <p class="p5">t = <span class="s2">Tuning</span>.et12;</p>
35 <p class="p6"><span class="s3">t.semitones;<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]</p>
36 <p class="p6"><span class="s3">t.ratios;<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// [ 1, 1.0594630943591, 1.1224620483089, 1.1892071150019, etc. ]</p>
37 <p class="p2"><br></p>
38 <p class="p5"><span class="s2">Pbind</span>(<span class="s4">\scale</span>, <span class="s2">Scale</span>.major(t), <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>
39 <p class="p2"><br></p>
40 <p class="p6">// use non-standard tuning</p>
41 <p class="p5">t = <span class="s2">Tuning</span>.just;</p>
42 <p class="p6"><span class="s3">t.semitones;<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// [ 0, 1.1173128526978, 2.0391000173077, 3.1564128700055, etc. ]</p>
43 <p class="p6"><span class="s3">t.ratios.collect(</span><span class="s2">_</span><span class="s3">.round(0.001));<span class="Apple-tab-span"> </span></span>// [ 1, 1.067, 1.125, 1.2, 1.25, 1.333, 1.406, 1.5, etc. ]</p>
44 <p class="p2"><br></p>
45 <p class="p5"><span class="s2">Pbind</span>(<span class="s4">\scale</span>, <span class="s2">Scale</span>.major(t), <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>
46 <p class="p2"><br></p>
47 <p class="p2"><br></p>
48 <p class="p7"><b><span class="s5">Creation</span></b></p>
49 <p class="p2"><br></p>
50 <p class="p3"><b>*et(pitchesPerOctave)</b></p>
51 <p class="p4"><br></p>
52 <p class="p3">Creates an equal-tempered scale based on <b>pitchesPerOctave</b>.</p>
53 <p class="p4"><br></p>
54 <p class="p3"><b>*just, *pythagorean, *werckmeister, *johnston, *partch, *wcAlpha, *bp, etc.</b></p>
55 <p class="p4"><br></p>
56 <p class="p3">Creates a tuning from the library stored in <b>TuningInfo</b>. For a complete list of available tunings, execute</p>
57 <p class="p4"><br></p>
58 <p class="p8"><span class="s6">Tuning</span>.directory</p>
59 <p class="p4"><br></p>
60 <p class="p3"><b>*choose(size)</b></p>
61 <p class="p4"><br></p>
62 <p class="p3">Creates a random tuning from the library, constrained by size (which defaults to 12).</p>
63 <p class="p4"><br></p>
64 <p class="p5"><span class="s2">Scale</span>.major(<span class="s2">Tuning</span>.choose).tuning.name;</p>
65 <p class="p2"><br></p>
66 <p class="p3"><b>*new(tuning, octaveRatio, name)</b></p>
67 <p class="p4"><br></p>
68 <p class="p3">Creates a <b>Tuning</b> using some or all of the parameters as follows: <b>tuning</b> can be the name of a library tuning (in which case that tuning is returned); an array of floats representing the semitone values of the tuning (in which case pitchesPerOctave will be set to the size of the array regardless of the second parameter); or nil (in which case the default tuning for <b>pitchesPerOctave</b> will be returned). <b>octaveRatio</b> defaults to 2.0, but can be set differently for stretched or compressed tunings.</p>
69 <p class="p4"><br></p>
70 <p class="p3">Examples:</p>
71 <p class="p4"><br></p>
72 <p class="p6"><span class="s2">Tuning</span><span class="s3">.new(</span><span class="s4">\et12</span><span class="s3">);<span class="Apple-tab-span"> </span></span>// standard equal temperament</p>
73 <p class="p6">// custom tuning</p>
74 <p class="p5"><span class="s2">Tuning</span>.new(#[ 0, 0.795, 2.251, 3.251, 4.036, 4.680, 5.915, 7.221, 8.013, 9.29, 9.930, 11.032 ]);<span class="Apple-converted-space"> </span></p>
75 <p class="p5"><span class="s2">Tuning</span>.new((0..11).collect(<span class="s2">_</span> * (2.08 ** (1/12))), 2.08, "Stretched ET12");</p>
76 <p class="p4"><br></p>
77 <p class="p4"><br></p>
78 <p class="p7"><b><span class="s5">Instance Methods</span></b></p>
79 <p class="p4"><br></p>
80 <p class="p3"><b>semitones</b></p>
81 <p class="p4"><br></p>
82 <p class="p3">Returns an array of semitone values for the pitch set. <b>as(Array)</b> is equivalent; <b>as(List)</b> returns it as a list, etc.</p>
83 <p class="p4"><br></p>
84 <p class="p3"><b>cents</b></p>
85 <p class="p4"><br></p>
86 <p class="p3">Returns a array of cent values for the pitch set.</p>
87 <p class="p4"><br></p>
88 <p class="p3"><b>ratios</b></p>
89 <p class="p4"><br></p>
90 <p class="p3">Returns a tuned array of ratios for the pitch set.</p>
91 <p class="p4"><br></p>
92 <p class="p4"><br></p>
93 <p class="p7"><b><span class="s5">Examples</span></b></p>
94 <p class="p2"><br></p>
95 <p class="p3">For examples of use, see the <a href="Scale.html"><span class="s1"><b>Scale</b></span></a> help file.</p>
96 </body>
97 </html>