|
1 |
| -<!DOCTYPE html> |
| 1 | +<!doctype html> |
2 | 2 | <html>
|
3 |
| -<head> |
4 |
| - <meta charset="utf-8"> |
5 |
| - <title>Analyser</title> |
| 3 | + <head> |
| 4 | + <meta charset="utf-8" /> |
| 5 | + <title>Analyser</title> |
6 | 6 |
|
7 |
| - <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
8 |
| - <link rel="icon" type="image/png" sizes="174x174" href="./favicon.png"> |
| 7 | + <meta |
| 8 | + name="viewport" |
| 9 | + content="width=device-width, initial-scale=1, maximum-scale=1" |
| 10 | + /> |
| 11 | + <link |
| 12 | + rel="icon" |
| 13 | + type="image/png" |
| 14 | + sizes="174x174" |
| 15 | + href="./favicon.png" |
| 16 | + /> |
9 | 17 |
|
10 |
| - <script src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/2.4.3/webcomponents-bundle.js"></script> |
11 |
| - <link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet"/> |
12 |
| - <script src="../build/Tone.js"></script> |
13 |
| - <script src="./js/tone-ui.js"></script> |
14 |
| - <script src="./js/components.js"></script> |
| 18 | + <script src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/2.4.3/webcomponents-bundle.js"></script> |
| 19 | + <link |
| 20 | + href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" |
| 21 | + rel="stylesheet" |
| 22 | + /> |
| 23 | + <script src="../build/Tone.js"></script> |
| 24 | + <script src="./js/tone-ui.js"></script> |
| 25 | + <script src="./js/components.js"></script> |
| 26 | + </head> |
| 27 | + <body> |
| 28 | + <tone-example label="Analyser"> |
| 29 | + <tone-loader></tone-loader> |
15 | 30 |
|
16 |
| -</head> |
17 |
| -<body> |
18 |
| - <tone-example label="Analyser"> |
19 |
| - <tone-loader></tone-loader> |
| 31 | + <div slot="explanation"> |
| 32 | + <a |
| 33 | + href="https://tonejs.github.io/docs/latest/classes/FFT" |
| 34 | + target="_blank" |
| 35 | + >Tone.FFT</a |
| 36 | + > |
| 37 | + returns the amplitude of the incoming signal at different |
| 38 | + frequencies. |
| 39 | + <a |
| 40 | + href="https://tonejs.github.io/docs/latest/classes/Waveform" |
| 41 | + target="_blank" |
| 42 | + >Tone.Waveform</a |
| 43 | + > |
| 44 | + returns the signal value between 0-1. |
| 45 | + </div> |
20 | 46 |
|
21 |
| - <div slot="explanation"> |
22 |
| - <a href="https://tonejs.github.io/docs/FFT" target="_blank">Tone.FFT</a> |
23 |
| - returns the amplitude of the incoming signal at different frequencies. |
24 |
| - <a href="https://tonejs.github.io/docs/Waveform" target="_blank">Tone.Waveform</a> |
25 |
| - returns the signal value between 0-1. |
26 |
| - </div> |
| 47 | + <div id="content"> |
| 48 | + <tone-play-toggle></tone-play-toggle> |
| 49 | + </div> |
| 50 | + </tone-example> |
27 | 51 |
|
28 |
| - <div id="content"> |
29 |
| - <tone-play-toggle></tone-play-toggle> |
30 |
| - </div> |
31 |
| - </tone-example> |
| 52 | + <script type="text/javascript"> |
| 53 | + const player = new Tone.Player({ |
| 54 | + url: "https://tonejs.github.io/audio/berklee/arpeggio2.mp3", |
| 55 | + loop: true, |
| 56 | + }).toDestination(); |
32 | 57 |
|
33 |
| - <script type="text/javascript"> |
34 |
| - const player = new Tone.Player({ |
35 |
| - url: "https://tonejs.github.io/audio/berklee/arpeggio2.mp3", |
36 |
| - loop: true |
37 |
| - }).toDestination(); |
| 58 | + const toneMeter = new Tone.Meter(); |
| 59 | + player.connect(toneMeter); |
38 | 60 |
|
39 |
| - const toneMeter = new Tone.Meter(); |
40 |
| - player.connect(toneMeter); |
| 61 | + const toneFFT = new Tone.FFT(); |
| 62 | + player.connect(toneFFT); |
41 | 63 |
|
42 |
| - const toneFFT = new Tone.FFT(); |
43 |
| - player.connect(toneFFT); |
| 64 | + const toneWaveform = new Tone.Waveform(); |
| 65 | + player.connect(toneWaveform); |
44 | 66 |
|
45 |
| - const toneWaveform = new Tone.Waveform(); |
46 |
| - player.connect(toneWaveform); |
| 67 | + // bind the GUI |
| 68 | + drawer().add({ |
| 69 | + tone: player, |
| 70 | + title: "Player", |
| 71 | + }); |
| 72 | + meter({ |
| 73 | + tone: toneMeter, |
| 74 | + parent: document.querySelector("#content"), |
| 75 | + }); |
| 76 | + fft({ |
| 77 | + tone: toneFFT, |
| 78 | + parent: document.querySelector("#content"), |
| 79 | + }); |
| 80 | + waveform({ |
| 81 | + tone: toneWaveform, |
| 82 | + parent: document.querySelector("#content"), |
| 83 | + }); |
47 | 84 |
|
48 |
| - // bind the GUI |
49 |
| - drawer().add({ |
50 |
| - tone: player, |
51 |
| - title: "Player", |
52 |
| - }); |
53 |
| - meter({ |
54 |
| - tone: toneMeter, |
55 |
| - parent: document.querySelector("#content") |
56 |
| - }); |
57 |
| - fft({ |
58 |
| - tone: toneFFT, |
59 |
| - parent: document.querySelector("#content") |
60 |
| - }); |
61 |
| - waveform({ |
62 |
| - tone: toneWaveform, |
63 |
| - parent: document.querySelector("#content") |
64 |
| - }); |
65 |
| - |
66 |
| - document.querySelector("tone-play-toggle").addEventListener("start", () => player.start()); |
67 |
| - document.querySelector("tone-play-toggle").addEventListener("stop", () => player.stop()); |
68 |
| - |
69 |
| - </script> |
70 |
| -</body> |
| 85 | + document |
| 86 | + .querySelector("tone-play-toggle") |
| 87 | + .addEventListener("start", () => player.start()); |
| 88 | + document |
| 89 | + .querySelector("tone-play-toggle") |
| 90 | + .addEventListener("stop", () => player.stop()); |
| 91 | + </script> |
| 92 | + </body> |
71 | 93 | </html>
|
0 commit comments