Playback of MIDI/Ogg

May 29, 2009 at 12:52 PM

Hi Mark,

First off all, congrats on developing this library. It is a very usefull codebase and the only free one worth looking ionto that I found.

I would like to know if MIDI and/or Ogg playback is possible because the Demo only showcase MP3 and WAV playback at the time and we need to implement MIDI playback at least.

Is there a way I could add MIDI playback to the library and if yes, is there a procedure I could follow to get things up and running quickly ?

Thanks for your time!


Jun 8, 2009 at 8:37 AM

Hi JD,

I'm afraid that ogg playback is not supported yet. To do so, I would probably try to find a managed library that can convert ogg to WAV, and from there it would be simple to create an ogg reader WAV stream. MIDI playback is more involved, as you need a synthesizer (hardware or software) to play back the sounds. At some point in the future I would love to see if I could use some of the VST.NET project to load a soft-synth and play back MIDI.


Aug 22, 2009 at 12:11 PM
Edited Aug 22, 2009 at 12:12 PM

Hi Mark, what about playing MIDI? I mean playing it from memory and not playing a file directly.

I'm going to write a MIDI player with some filtering features, like note pitching, channel muting and tempo changer.

I'm comparing NAudio with the MIDIToolkit from CodeProject (here).
MIDI Toolkit can play MIDI directly from its model, without the needing to save it into a file.
It raises an event at each event  sent to MIDI Out, this gives an hook to patch the MIDI on the fly.

This is great for me because:

  1. I can read the MIDI and play it directly
  2. I can apply MIDI filters at runtime, enabling and disabling them while playing
  3. I don't need to create several temp file

I'd like to use NAudio because I think its object model is better, the library seems faster and, also, it has analog audio support which could be a great plus in the future.

Is there a way to play a MIDI directly from its object model?

Thanks for your work

Aug 23, 2009 at 4:04 PM

Hi nicorac,

I'm afraid I haven't finished writing the wrappers for the Windows midiOut API's. Part of the reason is that they are only really useful if you are controlling external hardware or have a MIDI synthesizer on your soundcard. For those people like myself who rely mainly on software synths, the midiOut is of limited benefit. Maybe a future feature of NAudio would be to expand this area, but I am not actively working on it at the moment.