From 3790a058911f070358c328ee550566030f119ff5 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Wed, 1 Feb 2023 12:48:51 +0100 Subject: [PATCH] Avoid sending zero velocity note ons with MIDI --- src/midi.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/midi.rs b/src/midi.rs index 7c067c9a..0c5f7fb0 100644 --- a/src/midi.rs +++ b/src/midi.rs @@ -498,7 +498,8 @@ impl NoteEvent { } => Some(MidiResult::Basic([ midi::NOTE_ON | channel, note, - (velocity * 127.0).round().clamp(0.0, 127.0) as u8, + // MIDI treats note ons with zero velocity as note offs, because reasons + (velocity * 127.0).round().clamp(1.0, 127.0) as u8, ])), NoteEvent::NoteOff { timing: _,