tone connected
This commit is contained in:
15
.vscode/launch.json
vendored
Normal file
15
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "pwa-chrome",
|
||||
"request": "launch",
|
||||
"name": "Launch Chrome against localhost",
|
||||
"url": "http://localhost:8080",
|
||||
"webRoot": "${workspaceFolder}"
|
||||
}
|
||||
]
|
||||
}
|
||||
16
app.js
Normal file
16
app.js
Normal file
@@ -0,0 +1,16 @@
|
||||
// element identifiers
|
||||
|
||||
const element = document.getElementById("start-tone");
|
||||
const synthButton = document.getElementById("synth-button");
|
||||
|
||||
element.onclick = async () => {
|
||||
await Tone.start()
|
||||
.then(synthButton.style.display = "block");
|
||||
}
|
||||
|
||||
const synth = new Tone.Synth().toMaster();
|
||||
|
||||
synthButton.onclick = () => {
|
||||
synth.triggerAttackRelease("C4", "8n")
|
||||
}
|
||||
|
||||
15
index.html
Normal file
15
index.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="./app.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Tone</h1>
|
||||
<button id="start-tone">START?</button>
|
||||
<button id="synth-button">SYNTH???</button>
|
||||
|
||||
<script type="module" src="app.js"></script>
|
||||
<script src="https://unpkg.com/tone/build/Tone.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
3
requireTone.js
Normal file
3
requireTone.js
Normal file
@@ -0,0 +1,3 @@
|
||||
const Tone = require('tone');
|
||||
|
||||
module.exports = Tone;
|
||||
Reference in New Issue
Block a user