5 <title>Tinnitus
</title>
14 background-color: magenta;
18 function innerhtml(el
, txt
)
20 if (txt
== undefined){
21 return document
.getElementById(el
).innerHTML
;
23 else document
.getElementById(el
).innerHTML
= txt
;
29 return document
.getElementById(el
).value
;
31 else document
.getElementById(el
).value
= v
;
34 function fromradio(radio
)
36 var l
= document
.getElementsByName( radio
);
37 for(var i
=0; i
<l
.length
; i
++){
46 <h3 >Byzantine Scales
</h3>
47 <input type=
"number" id=
"s" onchange=
"tune()" value=
0.0> Gain [
0.0 -
1.0]
</input>
48 <h3>Select your favorite pulse shape
</h3>
49 <input type=
"radio" name=
"shape" value=
"sine" checked
> Sine
50 <input type=
"radio" name=
"shape" value=
"triangle"> Triangle
51 <input type=
"radio" name=
"shape" value=
"sawtooth" > Sawtooth
52 <input type=
"radio" name=
"shape" value=
"square"> Square
<br><br>
54 <input type=
"text" id=
"t" onchange=
"key()" value='m'
>
56 <input type=
"radio" name=
"scale" onclick=
"tune()" checked value=
0> Διατονικό
57 <input type=
"radio" name=
"scale" onclick=
"tune()" value=
1> Χρωματικό μαλακό
58 <input type=
"radio" name=
"scale" onclick=
"tune()" value=
2> Χρωματικό σκλερό
59 <input type=
"radio" name=
"scale" onclick=
"tune()" value=
3> Εναρμονικό
61 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
0 checked
> δι
</input>
62 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
1> κε
63 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
2> Ζω
64 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
3> Νη
65 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
4> Πα
66 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
5> Βου
67 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
6> Γα
69 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
7> Δι
70 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
8> Κε
71 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
9> Ζω'
72 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
10> Νη'
73 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
11> Πα'
74 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
12> Βου'
75 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
13> Γα'
77 <input type=
"radio" name=
"tone" onclick=
"tune()" value=
14> Δι'
79 <button onclick=
"startstop()" id=
"b">Start
</button><br>
81 const quant
=1.009673533228511;
89 12+10+8+12+10+8+12+12,
90 12+10+8+12+10+8+12+12+10,
91 12+10+8+12+10+8+12+12+10+8,
92 12+10+8+12+10+8+12+12+10+8+12,
93 12+10+8+12+10+8+12+12+10+8+12+10,
94 12+10+8+12+10+8+12+12+10+8+12+10+8,
95 12+10+8+12+10+8+12+12+10+8+12+10+8+12,
104 8+14+8+8+14+8+12+8+14,
105 8+14+8+8+14+8+12+8+14+8,
106 8+14+8+8+14+8+12+8+14+8+8,
107 8+14+8+8+14+8+12+8+14+8+8+14,
108 8+14+8+8+14+8+12+8+14+8+8+14+8,
109 8+14+8+8+14+8+12+8+14+8+8+14+8+12,
118 12+6+20+4+6+20+4+12+6,
119 12+6+20+4+6+20+4+12+6+20,
120 12+6+20+4+6+20+4+12+6+20+4,
121 12+6+20+4+6+20+4+12+6+20+4+6,
122 12+6+20+4+6+20+4+12+6+20+4+6+20,
123 12+6+20+4+6+20+4+12+6+20+4+6+20+4,
131 12+6+12+12+6+12+12+12,
132 12+6+12+12+6+12+12+12+6,
133 12+6+12+12+6+12+12+12+6+12,
134 12+6+12+12+6+12+12+12+6+12+12,
135 12+6+12+12+6+12+12+12+6+12+12+6,
136 12+6+12+12+6+12+12+12+6+12+12+6+12,
137 12+6+12+12+6+12+12+12+6+12+12+6+12+12,
147 if(osc0
== undefined){
150 osc0
.type
= fromradio("shape");
151 osc0
.frequency
.value
=
152 220.0*quant
**freq
[15*parseInt(fromradio("scale"))
153 + parseInt(fromradio("tone"))];
154 // console.log(osc0.frequency.value);
155 gainNode0
.gain
.value
= value("s");
160 if (innerhtml('b') == 'Stop'){
163 innerhtml('b', 'Start');
166 ctx
= new window
.AudioContext();
167 osc0
= ctx
.createOscillator();
168 gainNode0
= ctx
.createGain();
169 osc0
.connect(gainNode0
);
170 gainNode0
.connect(ctx
.destination
);
173 innerhtml('b', 'Stop');