1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
<style>
.note {
color: #339;
text-decoration: underline;
cursor: pointer;
}
* {
cursor: default;
}
pre {
white-space: pre-line;
}
</style>
<script type="text/scale" id="meantone-scl">
! meanquar.scl
!
1/4-comma meantone scale. Pietro Aaron's temperament (1523)
12
!
76.04900
193.15686
310.26471
5/4
503.42157
579.47057
696.57843
25/16
889.73529
1006.84314
1082.89214
2/1
</script>
<script type="text/scale" id="twelveet-scl">
! 12et.scl
!
12 equal temperament
12
!
100.
200.
300.
400.
500.
600.
700.
800.
900.
1000.
1100.
1200.
</script>
<pre>
<script src="intonation.js"></script>
<script>
var delim = "</span> <span>"
function write(s){ document.write("<span>" + (s || "") + "</span>\n") }
s = new Intonation({
intervals: '1/1 9/8 5/4 4/3 3/2 5/3 15/8 2/1',
})
write("original scale:")
write( s.range(0, 10).map(function(i){ return i.toFixed(0) }).join(delim) )
write("")
s = new Intonation({
root: 450,
intervals: '1/1 9/8 5/4 4/3 3/2 5/3 15/8 2/1',
})
write("root @ 450:")
write( s.range(0, 10).map(function(i){ return i.toFixed(0) }).join(delim) )
write("")
s = new Intonation({
tet: 5,
})
write("5-tet")
write( s.range(0, 6).map(function(i){ return i.toFixed(0) }).join(delim) )
write("")
s = new Intonation({
tet: 12,
})
write("12-tet")
write( s.range(0, 13).map(function(i){ return i.toFixed(0) }).join(delim) )
write("")
s = new Intonation({
scl: document.querySelector("#twelveet-scl").innerHTML
})
write("12-tet.scl:")
write( s.range(0, s.scale.length+1).map(function(i){ return i.toFixed(0) }).join(delim) )
write("")
s = new Intonation({
tet: 17,
})
write("17-tet")
write( s.range(0, 18).map(function(i){ return i.toFixed(0) }).join(delim) )
write("")
s = new Intonation({
intervals: '1/1 81/80 33/32 21/20 16/15 12/11 11/10 10/9 9/8 8/7 7/6 32/27 6/5 11/9 5/4 14/11 9/7 21/16 4/3 27/20 11/8 7/5 10/7 16/11 40/27 3/2 32/21 14/9 11/7 8/5 18/11 5/3 27/16 12/7 7/4 16/9 9/5 20/11 11/6 15/8 40/21 64/33 160/81 2/1',
})
write("partch:")
write( s.range(0, 44).map(function(i){ return i.toFixed(0) }).join(delim) )
write("")
s = new Intonation({
scl: document.querySelector("#meantone-scl").innerHTML
})
write("meantone.scl:")
write( s.range(0, s.scale.length+1).map(function(i){ return i.toFixed(0) }).join(delim) )
write("")
</script>
<script src="http://asdf.us/harp/js/vendor/Tone.min.js"></script>
<script>
polysynth = new Tone.PolySynth(8, Tone.synth)
polysynth.set({
oscillator: { type: "sine" },
envelope:{
attack: 0.01,
decay: 2.5,
sustain: 0.0,
release: 0.1,
}
})
var comp = new Tone.Compressor(-30, 3).toMaster()
polysynth.connect(comp)
Array.prototype.slice.apply( document.querySelectorAll("span") ).forEach(function(span){
if (! span.innerHTML.match(/[^0-9]/)) {
var f = parseInt(span.innerHTML)
span.classList.add("note")
span.addEventListener("click", function(){
polysynth.triggerAttackRelease(f, 1.5)
})
}
})
</script>
|