diff --git a/app.js b/app.js index 4197614..bc2f856 100644 --- a/app.js +++ b/app.js @@ -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(); +}) + diff --git a/index.html b/index.html index 86e791d..a9c814e 100644 --- a/index.html +++ b/index.html @@ -3,6 +3,7 @@ +