-
Notifications
You must be signed in to change notification settings - Fork 1
/
benmu.html
61 lines (59 loc) · 1.46 KB
/
benmu.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
50
51
52
53
54
55
56
57
58
59
60
61
<html>
<head>
<script src="benmu-magic.js"></script>
<style>
#oneliner {
font-size:22px;
padding:5px;
width: 80%;
font-family: monospace;
color:#99ff99;
background:black;
text-shadow: 0px 0px 2px #ffffff;
}
#gen {
font-family: monospace;
font-size:30px;
padding:10px;
width:80%;
}
</style>
</head>
<body>
<center>
<br/><br/><br/>
<form onsubmit="play();return false;">
<input type="text" id="oneliner" value="t * ((t>>12|t>>8)&63&t>>4)"/><br/>
<input type="submit" value="Generate Sound" id="gen"/>
</form>
<br/><br/><span id="error"></span><br/>
<div id="player"></div>
<br/><br/><br/>
</center>
<pre>
For example:<br/><br/>
(t*(t>>8+t>>9)*100)+sin(t)
<br/>
Or try some from <a href="http://www.youtube.com/watch?v=GtQdIYUtAHg" target="_new">viznut's video</a>.
</pre>
<script>
function play() {
try {
playDataURI(makeURL());
document.getElementById('error').innerText = "";
} catch (err) {
document.getElementById('error').innerText = ""+err;
}
}
var x = document.createElement('audio');
var hasAudio = typeof(x.play) !== 'undefined';
if (!hasAudio) {
alert("You don't seem to have a browser that supports audio. It's ok, you're not a bad person. But this app will now fail.");
}
document.getElementById("oneliner").focus();
document.getElementById("gen").onclick = function () {
play();
};
</script>
</body>
</html>