react-midi-hooks
react-midi-hooks copied to clipboard
note on midi messages with velocity == 0 should be treated as note off messages as per Web MIDI standards
Context
I ran into an issue when using this library, primarily when processing a lot of midi messages in a short time (read: going back and forth on all piano keys in my midi controller).
After implementing midi handling manually using plain old Javascript I noticed I ran int the same issue. After reading through the Web MIDI API documentation I noticed something interesting in their examples:
![image](https://user-images.githubusercontent.com/1220084/179847770-71083a07-4164-4051-a4d8-8d19c099d280.png)
source: https://webaudio.github.io/web-midi-api/#a-simple-monophonic-sine-wave-midi-synthesizer
turns out we have to fall through
when the velocity of a note is 0. This is currently missing in the useConnectInput
hook from what I could see:
https://github.com/nickroberts404/react-midi-hooks/blob/master/src/use-connect-input.ts#L33L50
thought I'd bring it to your attention so you can fix it 🙂