From b2a458e0dc2aeb7c69fc0733cc7d3c9a99c9348c Mon Sep 17 00:00:00 2001 From: Matthew Huntington Date: Sun, 22 Dec 2024 19:11:00 -0500 Subject: [PATCH] highest/lowest can be #/b --- app.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app.js b/app.js index 302b959..451cf33 100644 --- a/app.js +++ b/app.js @@ -40,10 +40,10 @@ generateToneButton.addEventListener('click', () => { generateNoteButton.addEventListener('click', () => { Tone.start() - const lowOctave = parseInt(lowest.charAt(1)) * 12 - const lowNote = notes.findIndex(enharmonics => enharmonics.includes(lowest.charAt(0))) - const highOctave = parseInt(highest.charAt(1)) * 12 - const highNote = notes.findIndex(enharmonics => enharmonics.includes(highest.charAt(0))) + const lowOctave = parseInt(lowest.charAt(lowest.length - 1)) * 12 + const lowNote = notes.findIndex(enharmonics => enharmonics.includes(lowest.substring(0, lowest.length-1))) + const highOctave = parseInt(highest.charAt(highest.length - 1)) * 12 + const highNote = notes.findIndex(enharmonics => enharmonics.includes(highest.substring(0, highest.length-1))) const lowPitch = lowOctave + lowNote const highPitch = highOctave + highNote @@ -55,8 +55,8 @@ generateNoteButton.addEventListener('click', () => { const randomPitchNote = randomPitch % 12 newTone = notes[randomPitchNote][0] + randomPitchOctave - newTone = teoria.note(newTone).fq() toneDisplay.innerHTML = newTone + newTone = teoria.note(newTone).fq() }) playButton.addEventListener('click', ()=>{