Skip to content

Commit 18649e2

Browse files
committed
JZZ test code
1 parent d27c988 commit 18649e2

File tree

1 file changed

+35
-17
lines changed

1 file changed

+35
-17
lines changed

Diff for: player/test-page/index.html

+35-17
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,23 @@
55
<title>alda-player.js test page</title>
66
</head>
77
<body>
8+
<p>IMPORTANT: For alda.wasm to work on this page:</p>
9+
<ol>
10+
<li>
11+
<code>alda.wasm</code> must be present in the same directory.
12+
</li>
13+
<li>
14+
You must view this page served on localhost, instead of viewing the HTML
15+
file directly in your browser.
16+
</li>
17+
</ol>
18+
<p>
19+
The easiest way to get this test page working is to run the
20+
<code>serve</code> script in this directory. The script will fetch the
21+
latest version of <code>alda.wasm</code> and use the npm
22+
<a href="https://www.npmjs.com/package/http-server">http-server</a> package
23+
to serve the contents of this directory, including this page.
24+
</p>
825
<script src="wasm_exec.js"></script>
926
<script>
1027
if (!WebAssembly.instantiateStreaming) { // polyfill
@@ -25,22 +42,23 @@
2542
});
2643
</script>
2744
<script src="alda-player.js"></script>
28-
<p>IMPORTANT: For alda.wasm to work on this page:</p>
29-
<ol>
30-
<li>
31-
<code>alda.wasm</code> must be present in the same directory.
32-
</li>
33-
<li>
34-
You must view this page served on localhost, instead of viewing the HTML
35-
file directly in your browser.
36-
</li>
37-
</ol>
38-
<p>
39-
The easiest way to get this test page working is to run the
40-
<code>serve</code> script in this directory. The script will fetch the
41-
latest version of <code>alda.wasm</code> and use the npm
42-
<a href="https://www.npmjs.com/package/http-server">http-server</a> package
43-
to serve the contents of this directory, including this page.
44-
</p>
45+
46+
<!--
47+
Temporary JZZ test code.
48+
TODO: Bundle JZZ with alda-player.js?
49+
-->
50+
<script src="https://cdn.jsdelivr.net/npm/jzz"></script>
51+
<script src="https://cdn.jsdelivr.net/npm/jzz-synth-tiny"></script>
52+
<script>
53+
function test_jzz() {
54+
let tiny = JZZ.synth.Tiny();
55+
const randomProgramNumber = Math.floor(Math.random() * 128);
56+
tiny.program(0, randomProgramNumber).noteOn(0, 'C5', 127)
57+
.wait(500).noteOn(0, 'E5', 127)
58+
.wait(500).noteOn(0, 'G5', 127)
59+
.wait(500).noteOff(0, 'C5').noteOff(0, 'E5').noteOff(0, 'G5');
60+
}
61+
</script>
62+
<button onclick="test_jzz()">click me to make sound</button>
4563
</body>
4664
</html>

0 commit comments

Comments
 (0)