note generation works with analyzer

master
Matthew Huntington 1 year ago
parent daa1f8b9fe
commit ad36d46486

@ -12,7 +12,6 @@ const getCentDifference = (startingFrequency, newFrequency) => {
} }
const generateCentsString = (centDifference) => { const generateCentsString = (centDifference) => {
console.log(centDifference);
const flatSharpChar = (centDifference > 0) ? '♯' : '♭' const flatSharpChar = (centDifference > 0) ? '♯' : '♭'
return flatSharpChar + Math.abs(parseInt(centDifference)).toString().padStart(2, '0') return flatSharpChar + Math.abs(parseInt(centDifference)).toString().padStart(2, '0')
} }

@ -55,6 +55,7 @@ generateNoteButton.addEventListener('click', () => {
const randomPitchNote = randomPitch % 12 const randomPitchNote = randomPitch % 12
newTone = notes[randomPitchNote][0] + randomPitchOctave newTone = notes[randomPitchNote][0] + randomPitchOctave
newTone = teoria.note(newTone).fq()
toneDisplay.innerHTML = newTone toneDisplay.innerHTML = newTone
}) })

Loading…
Cancel
Save