tone connected

This commit is contained in:
Mikayla Dobson
2022-05-09 11:46:35 -05:00
parent f4ff6e939f
commit d2e982fa52
5 changed files with 52 additions and 0 deletions

15
.vscode/launch.json vendored Normal file
View 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}"
}
]
}

3
app.css Normal file
View File

@@ -0,0 +1,3 @@
#synth-button {
display: none;
}

16
app.js Normal file
View 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
View 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
View File

@@ -0,0 +1,3 @@
const Tone = require('tone');
module.exports = Tone;