You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! I'm playing around with the MIDI input in Godot 4, and I've run into the issue where releasing a key on my MIDI keyboard does not return event.message 0x8, MIDI_MESSAGE_NOTE_OFF, but rather 0x9, which is MIDI_MESSAGE_NOTE_ON.
This is not the case in Godot 3. I created an identical script in each to test this out, and releasing the key in 3.x always returns 0x8, whereas releasing the key in 4 always returns 0x9.
Steps to reproduce
func _ready():
OS.open_midi_inputs()
func _input(event):
if event is InputEventMIDI:
print(event.message)
Minimal reproduction project
N/A
The text was updated successfully, but these errors were encountered:
I experienced the same situation recently. When I release a key on my MIDI device, a NOTE OFF message is received (observed with MIDI Monitor on macOS), but Godot would report it as a MIDI_MESSAGE_NOTE_ON message with velocity=0. This behavior is still within the MIDI spec, where a NOTE ON with velocity=0 means NOTE OFF. (I think this was a strategy used by some old synthesizers to send a sequence of NOTE ON, NOTE OFF messages as a stream of NOTE ON messages in a more compressed format, back when hardware throughput was a limiting factor. If your synth is connected with USB, it probably sends NOTE OFF messages... I don't know why Godot does this conversion when the MIDI device actually sent it NOTE OFF messages.)
Right, some devices send NOTE_ON with velocity=0 when a key is released, but other devices send NOTE_ON with velocity=0 when a key is pressed very gently. It depends on the devices, and Godot itself should not interfere with the MIDI data. The application developer (i.e. script writer) must be wary of NOTE_ON events with velocity 0 and convert them manually if appropriate for the game/application (it's very easy, just a couple lines of code).
Thanks @akien-mga for upholding my fix -- it's bound to confuse some folks from time to time, but then MIDI implementations have always had their quirks.
Godot version
4.0.2.stable.mono
System information
Windows 10
Issue description
Hello! I'm playing around with the MIDI input in Godot 4, and I've run into the issue where releasing a key on my MIDI keyboard does not return event.message 0x8, MIDI_MESSAGE_NOTE_OFF, but rather 0x9, which is MIDI_MESSAGE_NOTE_ON.
This is not the case in Godot 3. I created an identical script in each to test this out, and releasing the key in 3.x always returns 0x8, whereas releasing the key in 4 always returns 0x9.
Steps to reproduce
Minimal reproduction project
N/A
The text was updated successfully, but these errors were encountered: