2019-04-02 03:33:07 +00:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8" />
|
2020-07-18 00:36:42 +00:00
|
|
|
<title>Simple HTML</title>
|
2019-04-02 03:33:07 +00:00
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
2020-07-18 00:36:42 +00:00
|
|
|
<!-- LOAD Tone.js from unpkg -->
|
2021-07-12 12:31:17 +00:00
|
|
|
<script src="https://unpkg.com/tone"></script>
|
2019-04-02 03:33:07 +00:00
|
|
|
<script>
|
|
|
|
function playNote() {
|
2020-07-18 00:36:42 +00:00
|
|
|
// create a synth
|
2020-07-19 00:20:19 +00:00
|
|
|
const synth = new Tone.Synth().toDestination();
|
2020-07-18 00:36:42 +00:00
|
|
|
// play a note from that synth
|
2019-04-02 03:33:07 +00:00
|
|
|
synth.triggerAttackRelease("C4", "8n");
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h1>Simple HTML5 Tone.js Demo</h1>
|
|
|
|
<button onclick="playNote()">Click me to play note!</button>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|