Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to play MIDI sounds using C#

Tags:

I'm trying to rebuild an old metronome application that was originally written using MFC in C++ to be written in .NET using C#. One of the issues I'm running into is playing the midi files that are used to represent the metronome "clicks".

I've found a few articles online about playing MIDI in .NET, but most of them seem to rely on custom libraries that someone has cobbled together and made available. I'm not averse to using these, but I'd rather understand for myself how this is being done, since it seems like it should be a mostly trivial exercise.

So, am I missing something? Or is it just difficult to use MIDI inside of a .NET application?

like image 902
jerhinesmith Avatar asked Aug 12 '08 12:08

jerhinesmith


1 Answers

I'm working on a C# MIDI application at the moment, and the others are right - you need to use p/invoke for this. I'm rolling my own as that seemed more appropriate for the application (I only need a small subset of MIDI functionality), but for your purposes the C# MIDI Toolkit might be a better fit. It is at least the best .NET MIDI library I found, and I searched extensively before starting the project.

like image 103
Kjetil Limkjær Avatar answered Oct 06 '22 02:10

Kjetil Limkjær