I realize that MIDI On messages with velocity set to 0 are typically treated as Note Off messages, but they are technically different and I don't think all the teensy MIDI related libraries (MIDI. usbMIDI, usbHost) should be explicitly converting incoming Note On messages with velocity of 0 to Note Off behind the scenes.
I agree. If I'm using a library, I typically do
not want it to "lie" to me, especially where it's an external communication and real information is lost. The
only exception would be something like a serial protocol which uses escape characters to frame packets.
It's actually part of the Midi Spec that Note On Vel 0 will always be considered as a Note Off event, and all Midi devices 'should' be able to cope with it, and treat it as such.
True, but this should (IMHO) be done
at the application level,
not inside the library. In this case the device doesn't have the opportunity to cope - it never even sees it.
it is hard coded into the usbMidi & usbHost libraries that Note On Vel 0 will be flagged as a Note Off event,
This is sort of true, but it's not "flagged as", it's "converted to", which loses the information that what was received was a zero-velocity note on.
which (with lack of a custom setting) in my view is probably overall the better choice, but an option to turn this off wouldn't be bad idea
I disagree, I'd call it the worse choice,
unless the majority of Arduino libraries prior to
usbMIDI and
usbHost have done the same, and it's been implemented that way for consistency. In which case, it's
still a bad choice, but justifiable, and ideally should be well-documented and have a method to turn it off.
I am much more interested in practical effects and compatibility with widely used devices and software than rigorous adherence to specs or academic arguments about correctness.
Well in this instance the practical effect is that
@yeahtuna has "taken a long time to figure out" that the library is "was breaking the Mackie Control protocol". Mackie is definitely a reputable manufacturer (which of course doesn't necessarily mean they don't do weird stuff with MIDI, like insisting on a different interpretation for NoteOn@velocity0 and NoteOff@velocityN).
In your repos, we have:
Your MIDI repo is a fork of
this library (albeit 33 commits out of date), and that's the one that comes out top of the list when I do a web search for "Arduino MIDI", so that's probably canonical behaviour for the Arduino-like ecosystems. It's even documented
here.
The least worst thing to do would appear to be to add use of the
midi::DefaultSettings structure to
usbMIDI and
usbHost, so that any existing customisation can ported to Teensy with the minimum of changes.