react-midi-hooks icon indicating copy to clipboard operation
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

Open alexanderjeurissen opened this issue 1 year ago • 0 comments

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

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 🙂

alexanderjeurissen avatar Jul 19 '22 21:07 alexanderjeurissen