-
Notifications
You must be signed in to change notification settings - Fork 1
/
retried.html
36 lines (33 loc) · 1020 Bytes
/
retried.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
<!DOCTYPE HTML>
<html>
<head>
<script src="glue.js"></script>
<script src="makeSamples.js"></script>
<script src="benmu-riff.js"></script>
<script src="benmu-dataurl.js"></script>
<link type="text/css" href="style.css" rel="stylesheet"/>
</head>
<body>
<form onsubmit="return false;">
<input type="text" id="oneliner" value="127*sin(t/1000)"/><br/>
<input type="submit" value="Generate Sound" id="gen" />
</form>
<div id="error"></div>
<audio id="player" autoplay="true" controls="true"/>
<script>
var keyMap = { 13: play, 27: stop};
function onKey(event) {
var fn = keyMap[event.keyCode];
if(fn) fn();
}
function onPlay() {
var oneLiner = document.getElementById('oneliner').value;
sampleData = makeSampleData(oneLiner);
play(sampleData);
}
document.getElementById("oneliner").focus();
document.getElementById("oneliner").onkeydown = onKey;
document.getElementById("gen").onclick = onPlay;
</script>
</body>
</html>