From a3911e3187f1e92f293b751b9a95ccbb446839f2 Mon Sep 17 00:00:00 2001 From: cinnaboot Date: Sun, 18 Oct 2026 10:00:13 -0400 Subject: [PATCH] support NOTE_ON with vel 0 == NOTE_OFF --- src/midi.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/midi.cpp b/src/midi.cpp index 4b773bb..93d83d6 100644 --- a/src/midi.cpp +++ b/src/midi.cpp @@ -83,7 +83,15 @@ midiProcess(const snd_seq_event_t* ev) nev.note = ev->data.note.note; nev.channel = ev->data.note.channel; - nev.note_on = (ev->type == SND_SEQ_EVENT_NOTEON) ? true : false; + nev.note_on = false; + + // NOTE: NOTE_ON with velocity of 0 is also a common way to store NOTE_OFF in + // MIDI files + if ( ev->type == SND_SEQ_EVENT_NOTEON && + ev->data.note.velocity > 0) + { + nev.note_on = true; + } } else if(ev->type == SND_SEQ_EVENT_CONTROLLER) {