-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
50 lines (48 loc) · 1.15 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Trolo1ko</title>
</head>
<body>
<script src="Trolo1ko.js"></script>
<script>
/* Notes :
* - Note name on a 88 keys piano keyboard (A4, B3#...)
* - Rythm :
* . Whole note 0
* . Half note 1
* . Quarter note 2
* . Eigth note 3
* . Sixteenth note 4
* . Dotted half note 1.5
* ...
*/
var sheet = [
['E3', 4], ['G3', 4], ['A3', 4], ['B3', 4],
['C4', 0.5], ['G3', 3], ['F3', 3], ['G3', 0.5],
['C3', 3], ['D3', 3], ['E3', 1], ['G3', 1],
['D3', 2], ['C3', 1], ['E3', 4], ['G3', 4],
['A3', 4], ['C4', 4], ['B3', 3], ['B3', 4],
['G3', 4], ['A3', 3], ['A3', 4], ['E3', 4],
['G3', 2], ['C3', 4], ['D3', 4], ['E3', 4],
['F3', 4], ['E3', 0.5]
];
/*
* Player :
* - Constructor(sheet)
* . sheet : The sheet music to read
* - play(tempo, type)
* . tempo : Playing speed
* . type : Type of wave (sine, square, sawtooth...)
*/
var trololo = new Trolo1ko(sheet);
//Umm... enjoy !
</script>
<button
id="play"
onclick="trololo.play(104);">
Play
</button>
</body>
</html>