diff --git a/src/utils/math/midi.ts b/src/utils/math/midi.ts index e9f42de..c081ec0 100644 --- a/src/utils/math/midi.ts +++ b/src/utils/math/midi.ts @@ -1,7 +1,9 @@ /** * Gets frequency in Hz for corresponding MIDI note. + * + * Same as JUCE's `MidiMessage::getMidiNoteInHertz`: + * https://github.com/juce-framework/JUCE/blob/master/modules/juce_audio_basics/midi/juce_MidiMessage.cpp#L1037-L1040 */ export function midiNoteToFreq(note: number) { - const a = 440; - return (a / 32) * 2 ** ((note - 9) / 12); + return 440 * 2 ** ((note - 69) / 12); }