melanchall / drywetmidi

.NET library to read, write, process MIDI files and to work with MIDI devices

Home Page:https://melanchall.github.io/drywetmidi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NoteOn event fired even if I release the Note

arjOman opened this issue · comments

I have a Yamaha PSR-E473, connected through USB3. I was trying to listen to the NoteOff event, but it was never fired, even after releasing the key.

I suppose you use InputDevice. The class has SilentNoteOnPolicy property which declares how Note On event with zero velocity is handled. By default such events are treated as Note On ones, i.e. as is.

My assumption your device sends Note Off events as Note On ones with zero velocity. Just set SilentNoteOnPolicy to SilentNoteOnPolicy.NoteOff value:

inputDevice.SilentNoteOnPolicy = SilentNoteOnPolicy.NoteOff;
...
inputDevice.StartEventsListening();

Hi, changing the property did help. Thank you!