-
Notifications
You must be signed in to change notification settings - Fork 22
/
simple.html
49 lines (46 loc) · 1.32 KB
/
simple.html
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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script src="https://unpkg.com/@webcomponents/custom-elements"></script>
<script src="https://g200kg.github.io/webaudio-controls/webaudio-controls.js" ></script>
<script src="./webaudio-tinysynth.js"></script>
<script>
async function Init(){
synth=document.getElementById("tinysynth");
kb=document.getElementById("keyboard");
kb.addEventListener("change",KeyIn);
await synth.ready();
for(var i=0;i<128;++i){
var o=document.createElement("option");
o.innerHTML=(i+1)+" : "+synth.getTimbreName(0,i);
document.getElementById("prog").appendChild(o);
}
}
function Prog(pg){
synth.send([0xc0,pg]);
}
function KeyIn(e){
synth.send([0x90,e.note[1],e.note[0]?100:0]);
}
window.onload=function(){
Init();
}
</script>
</head>
<body>
<h1>TinySynth Simple Test Page</h1>
<ul>
<li>Select timbre with dropdown</li>
<li>Playable with mouse or qwerty-keyboard.</li>
<li>Drop MIDI-file(.mid) to TinySynth for play.</li>
</ul>
Prog : <select id="prog" onchange="Prog(this.selectedIndex)"></select>
<br/>
<webaudio-keyboard id="keyboard" min="48"></webaudio-keyboard>
<br/>
<webaudio-tinysynth id="tinysynth"></webaudio-tinysynth>
<hr/>
Repository : <b><a href="https://github.com/g200kg/webaudio-tinysynth">https://github.com/g200kg/webaudio-tinysynth</a></b>
</body>
</html>