Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

note on midi messages with velocity == 0 should be treated as note off messages as per Web MIDI standards #20

Open
alexanderjeurissen opened this issue Jul 19, 2022 · 0 comments

Comments

@alexanderjeurissen
Copy link

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 🙂

pcardune added a commit to pcardune/react-midi-hooks that referenced this issue Aug 9, 2024
See this issue for more details
nicorobo#20

TL;DR: some midi instruments send a "note on" message with velocity zero instead of "note off" messages. Prior to this change, the `useMidiNotes` hook would never remove notes from the list when using these instruments. Now those instruments work like other ones.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant