-
Notifications
You must be signed in to change notification settings - Fork 37
/
demo.html
39 lines (39 loc) · 1000 Bytes
/
demo.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Speak.js Demo</title>
<script src="speakClient.js"></script>
<script>
var period = 0;
function beat_it() {
if( period !== 0 ) {
speak('beat', {pitch: 10});
setTimeout(beat_it, period);
}
}
function stop_the_beat() {
period = 0;
}
function start_the_beat() {
period = document.getElementById('beat-frequency').value;
beat_it();
}
</script>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div id="audio"></div>
<input type="button" onclick="speak('hello world!')" value="Say 'Hello World!'" />
<br>
<br>
<label for="">Beat frequency</label>
<input id="beat-frequency" type="text" value="500" placeholder="Beat frequency (in miliseconds)'" />
<br>
<input type="button" onclick="start_the_beat()" value="Start The Beat!'" />
<br>
<input type="button" onclick="stop_the_beat()" value="Stop The Beat!'" />
</body>
</html>