Tone.js/examples/simpleHtml.html
2020-07-18 17:20:19 -07:00

24 lines
586 B
HTML

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>Simple HTML</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- LOAD Tone.js from unpkg -->
<script src="http://unpkg.com/tone"></script>
<script>
function playNote() {
// create a synth
const synth = new Tone.Synth().toDestination();
// play a note from that synth
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>