-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
82 lines (69 loc) · 2.01 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Vocalism</title>
<style>
body {
background-color: black;
}
</style>
<link rel="stylesheet" type="text/css" href="js/codemirror/codemirror.css">
<link rel="stylesheet" type="text/css" href="js/codemirror/tomorrow-night-eighties.css">
</head>
<body>
<label for="code"></label><textarea id="code" name="code" style="display: none;">
// hola, mundo!
// to run code, press Cmd-Enter
// to run a single line, press Shift-Enter
s = new Sampler()
s.reverb()
s.note(100)
s.sequence(["C4", "E4", "G4", "A4"],"4n")
// go through each line individually!
a = new Audio()
a.record()
a.stopRecord()
a.start()
a.volume(-10)
a.reverse()
a.distort(0.5)
a.pingPong("4n",0.2)
a.speed(0.5)
b = new Audio()
b.record()
b.stopRecord()
b.start()
</textarea>
<!--CodeMirror-->
<script src="js/codemirror/codemirror.js"></script>
<script src="js/codemirror/javascript.js"></script>
<!--Tone.js-->
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/recorderjs/0.1.0/recorder.js"></script>-->
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/tone/14.4.84/Tone.js"></script>-->
<!--<script src="https://unpkg.com/[email protected]/build/Tone.js"></script>-->
<script src="js/Tone.js"></script>
<script src="vocalism.js"></script>
<script>
const cm = CodeMirror.fromTextArea(document.getElementById('code'), {
theme: 'tomorrow-night-eighties',
mode: {name: 'javascript', globallets: true},
// lineWrapping: true,
styleSelectedText: true,
lineNumbers: true,
extraKeys: {
'Cmd-Enter': function () {
eval(cm.getValue())
// var result = function (str) {
// return eval(str);
// }.call(new Vocalism().init(), cm.getValue());
},
'Shift-Enter': function () {
eval(cm.doc.getLine(cm.doc.getCursor().line))
}
}
});
cm.focus()
</script>
</body>
</html>