1 <!-- This file is part of byzantine_scales. -->
3 <!-- byzantine_scales is free software: you can redistribute it and/or modify it -->
4 <!-- under the terms of the GNU General Public License as published by the -->
5 <!-- Free Software Foundation, either version 3 of the License, or (at your -->
6 <!-- option) any later version. -->
8 <!-- byzantine_scales is distributed in the hope that it will be useful, but WITHOUT -->
9 <!-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -->
10 <!-- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -->
11 <!-- for more details. -->
13 <!-- You should have received a copy of the GNU General Public License -->
14 <!-- along with byzantine_scales. If not, see <https://www.gnu.org/licenses/>. -->
19 <meta charset=
"utf-8">
20 <title>Byzantine_Scales
</title>
29 background-color: magenta;
33 function innerhtml(el
, txt
)
35 if (txt
== undefined){
36 return document
.getElementById(el
).innerHTML
;
38 else document
.getElementById(el
).innerHTML
= txt
;
44 return document
.getElementById(el
).value
;
46 else document
.getElementById(el
).value
= v
;
49 function fromradio(radio
)
51 var l
= document
.getElementsByName( radio
);
52 for(var i
=0; i
<l
.length
; i
++){
61 <h3 >Byzantine Scales
</h3>
62 <input type=
"number" id=
"s" onchange=
"tune()" value=
0.0> Gain [
0.0 -
1.0]
</input>
63 <h3>Select your favorite pulse shape
</h3>
64 <input type=
"radio" name=
"shape" value=
"sine" checked
> Sine
65 <input type=
"radio" name=
"shape" value=
"triangle"> Triangle
66 <input type=
"radio" name=
"shape" value=
"sawtooth" > Sawtooth
67 <input type=
"radio" name=
"shape" value=
"square"> Square
<br><br>
69 <input type=
"text" id=
"t" onchange=
"key()" value='m'
>
71 <input type=
"radio" name=
"scale" onclick=
"tune()" checked value=
0> Διατονικό
72 <input type=
"radio" name=
"scale" onclick=
"tune()" value=
1> Χρωματικό μαλακό
73 <input type=
"radio" name=
"scale" onclick=
"tune()" value=
2> Χρωματικό σκλερό
74 <input type=
"radio" name=
"scale" onclick=
"tune()" value=
3> Εναρμονικό
76 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
0 checked
> δι
</input>
77 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
1> κε
78 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
2> Ζω
79 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
3> Νη
80 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
4> Πα
81 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
5> Βου
82 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
6> Γα
84 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
7> Δι
85 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
8> Κε
86 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
9> Ζω'
87 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
10> Νη'
88 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
11> Πα'
89 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
12> Βου'
90 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
13> Γα'
92 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
14> Δι'
94 <button onclick=
"startstop()" id=
"b">Start
</button><br>
96 const quant
=1.009673533228511;
104 12+10+8+12+10+8+12+12,
105 12+10+8+12+10+8+12+12+10,
106 12+10+8+12+10+8+12+12+10+8,
107 12+10+8+12+10+8+12+12+10+8+12,
108 12+10+8+12+10+8+12+12+10+8+12+10,
109 12+10+8+12+10+8+12+12+10+8+12+10+8,
110 12+10+8+12+10+8+12+12+10+8+12+10+8+12,
119 8+14+8+8+14+8+12+8+14,
120 8+14+8+8+14+8+12+8+14+8,
121 8+14+8+8+14+8+12+8+14+8+8,
122 8+14+8+8+14+8+12+8+14+8+8+14,
123 8+14+8+8+14+8+12+8+14+8+8+14+8,
124 8+14+8+8+14+8+12+8+14+8+8+14+8+12,
133 12+6+20+4+6+20+4+12+6,
134 12+6+20+4+6+20+4+12+6+20,
135 12+6+20+4+6+20+4+12+6+20+4,
136 12+6+20+4+6+20+4+12+6+20+4+6,
137 12+6+20+4+6+20+4+12+6+20+4+6+20,
138 12+6+20+4+6+20+4+12+6+20+4+6+20+4,
146 12+6+12+12+6+12+12+12,
147 12+6+12+12+6+12+12+12+6,
148 12+6+12+12+6+12+12+12+6+12,
149 12+6+12+12+6+12+12+12+6+12+12,
150 12+6+12+12+6+12+12+12+6+12+12+6,
151 12+6+12+12+6+12+12+12+6+12+12+6+12,
152 12+6+12+12+6+12+12+12+6+12+12+6+12+12,
162 if(osc0
== undefined){
165 osc0
.type
= fromradio("shape");
166 osc0
.frequency
.value
=
167 220.0*quant
**freq
[15*parseInt(fromradio("scale"))
168 + parseInt(fromradio("tone"))];
169 // console.log(osc0.frequency.value);
170 gainNode0
.gain
.value
= value("s");
175 if (innerhtml('b') == 'Stop'){
178 innerhtml('b', 'Start');
181 ctx
= new window
.AudioContext();
182 osc0
= ctx
.createOscillator();
183 gainNode0
= ctx
.createGain();
184 osc0
.connect(gainNode0
);
185 gainNode0
.connect(ctx
.destination
);
188 innerhtml('b', 'Stop');