|
5 | 5 | <title>alda-player.js test page</title>
|
6 | 6 | </head>
|
7 | 7 | <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> |
8 | 25 | <script src="wasm_exec.js"></script>
|
9 | 26 | <script>
|
10 | 27 | if (!WebAssembly.instantiateStreaming) { // polyfill
|
|
25 | 42 | });
|
26 | 43 | </script>
|
27 | 44 | <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> |
45 | 63 | </body>
|
46 | 64 | </html>
|
0 commit comments