This project has moved and is read-only. For the latest updates, please go here.

MIDI NoteOff event missing

May 31, 2011 at 10:10 PM
Edited May 31, 2011 at 10:16 PM


i'm trying to use MIDI interface of NAudio and came across a little problem. When i press a key on the master keyboard, MessageReceived event fires up with the CommandCode NoteOn, but when i release the key it fires with NoteOn again.

Previously i wondered already about an exception which came up, cause the event couldn't be converted to NoteOnEvent, which really was (or should be) NoteOff.

Is it a bug in NAudio? Or should i check against velocity?


Edit: I searched a little bit and came across aftertouch and this thread from stackoverflow It sheds some light for me on this topic.


Thanks in advance


May 31, 2011 at 10:17 PM

Lots of MIDI keyboards send a note on with a velocity of 0 to mean note off (it requires less bytes being sent as it can be sent as a MIDI follow-on message). I suspect that is what you are seeing.


May 31, 2011 at 10:27 PM

Thanks for fast reply.


What would you suggest to process events? Maybe you know a good site which explains such things and what they are good for? I never really used aftertouch and a couple of other exotic features before, but trying to get back into sound processing and would like to experiment with such features of my keyboard (there is more in that thing, than the first look reveals). 

May 31, 2011 at 10:42 PM

well to do anything from NAudio would require you to either write or host a software synthesizer. Neither is a particularly easy task although I am in the process of writing some very basic demos for the next version of NAudio. What do you actually want to achieve?

Jun 3, 2011 at 10:00 AM


sorry for the late reply, but i had a lot of work-related stuff to do. 

Yes i'm trying to make a simple synth. Less for production, but rather for playing around with DSP and modular approach. It's especially about continuous data processing and parrallel programming.

For a couple of years now i wanted to create node-based application, just type into google if you don't know what i mean. Sometimes i lack time for this or even passion for programming at evenings, cause i'm already software developer in my job. Now i found both of it and wanted try it out. Maybe you have some pointer on modular data processing. I suppose in C# i have to use Object for plain data and cast or rather box/unbox it. In C++ i think it's void-poiner and casting.

Jun 6, 2011 at 9:37 AM

the next version of NAudio will hopefully contain some better examples for synth type applications. I'm already working on a drum machine and there will be a new interface called ISampleProvider which is intended to make it simpler to build modular effects paths. In the current version of NAudio the WaveBuffer class allows you to effectively do void pointer casting between arrays of bytes, shorts or floats as necessary.