Skip to content

Commit

Permalink
Unify MIDI note calculation with the audio feature's algorithm (#21588)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nebuleon authored Jul 27, 2023
1 parent 727b1d1 commit 96789a7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions quantum/midi/qmk_midi.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ static void fallthrough_callback(MidiDevice* device, uint16_t cnt, uint8_t byte0
if (cnt == 3) {
switch (byte0 & 0xF0) {
case MIDI_NOTEON:
play_note(((double)261.6) * pow(2.0, -4.0) * pow(2.0, (byte1 & 0x7F) / 12.0), (byte2 & 0x7F) / 8);
play_note(440.0f * powf(2.0f, ((byte1 & 0x7F) - 57) / 12.0f), (byte2 & 0x7F) / 8);
break;
case MIDI_NOTEOFF:
stop_note(((double)261.6) * pow(2.0, -4.0) * pow(2.0, (byte1 & 0x7F) / 12.0));
stop_note(440.0f * powf(2.0f, ((byte1 & 0x7F) - 57) / 12.0f));
break;
}
}
Expand Down

0 comments on commit 96789a7

Please sign in to comment.