electro-smith/libDaisy

Running Status with both Note Ons and Note Offs not handled correctly

hammondeggs opened this issue · 1 comments

incoming_message_.type = running_status_ = NoteOff;

Issue:
Currently, note ons (0x9x) sent with running status using both velocity values for note on and velocity values for note offs will result in missed messages.

Method Of Reproduction:
Using a Yamaha Motif XF, play some notes, ideally a few close together timing wise, as this synth appears to only send 0x9x for all note on / note off messages, using velocity 0x00 for Note Off. Occasionally it will do so using MIDI running status for both note ons and note offs, reproducing this issue.

e.g. (hex)
90 37 40 35 00 39 40 0x90 37 00
This would be:
90 - NoteOn channel "1"
37 - Note num (G)
40 - Velocity > 0 so note is on
35 - Note num (F) (running status)
00 - Velocity == 0 so note is off, here, currently the running status type is demoted to noteoff
39 - Note num (A)
40 - Velocity >0 but with current implementation, this note is sent as a noteoff
90 - New NoteOn
37 - Note num (F)
00 - Velocity == 0 so note is off

Suggested Fix:
This issue appears to be fixed for me, by replacing this line with
incoming_message_.type = NoteOff;

This way, the running status message type is preserved and not demoted for the next running status bytes, but the message type is changed for the event.

Hey @hammondeggs thanks for writing up such a thorough issue!

Having the particular hex that breaks it is extremely useful!

This particular issue is actually being resolved in #515 which should be reviewed/merged today.