master
Matthew Huntington 1 year ago
parent d772fe806e
commit cea1ed7da5

@ -3,10 +3,22 @@ const highest = 4186
const range = highest - lowest
const generateButton = document.querySelector('body > button')
const playButton = document.querySelector('section > button:nth-of-type(1)')
const stopButton = document.querySelector('section > button:nth-of-type(2)')
const toneDisplay = document.querySelector('section dd')
const synth = new Tone.Synth().toDestination()
let newTone
generateButton.addEventListener('click', () => {
newTone = Math.random() * range + lowest
toneDisplay.innerHTML = newTone
})
playButton.addEventListener('click', ()=>{
synth.triggerAttackRelease("C4");
})
stopButton.addEventListener('click', ()=>{
synth.triggerRelease();
})

@ -3,6 +3,7 @@
<head>
<meta charset="UTF-8">
<title></title>
<script src="http://unpkg.com/tone"></script>
<script src="app.js" defer></script>
</head>
<body>

Loading…
Cancel
Save