Closed paradox460 closed 2 years ago
Investigating a bit more, it looks like this plugin reads the velocity of the midi message (msg[2]
). This may work in testing because the virtual keyboard used emits a velocity of 0 for keyups, but my real MIDI keyboard does not.
Instead, the status byte should be referenced.
For a key down event, we see that we get a status byte of 144, a key number of 55, and a velocity of 62 (I pushed the key with a moderate amount of force, mezzo-forte if I were to judge)
144, translated into hexadecimal, is 0x90, which is indicated on this page as a Key Down event. You can cross-check this against the official MIDI tables here, but they use binary, so you have to translate 144 into binary (1001 0000
)
When we release the key, we see that we have a different status byte, 128 this time
128, translated into hex, is 0x80, which indicates a key up event.
Patching the functions in midi-in.ts
to use this information, instead of relying on velocity, nets us this happy result:
I have fixed this in #342
Thank you so much for this--merging into dev and I will be checking tomorrow before releasing a new version.
I am using a KORG microKEY AIR (bluetooth 25key midi keyboard) on MacOS 10.15.7, and when attempting to input notes, I get a "double note" effect. Pressing the key gets one note entered into the document, but releasing it gets the same note.
Additionally, there is some carry-over from previously entered notes.