Quantcast
Channel: NAudio
Viewing all articles
Browse latest Browse all 5831

New Post: MIDI IN letters notes, insetad numbers?..... a big problem

$
0
0

Do something like this:

string message = e.MidiEvent.ToString();
if (e.MidiEvent is NoteEvent)
{
   NoteEvent n = (NoteEvent)e.MidiEvent;
   message = String.Format("{0} {1} Ch: {2} Note:{3} Vel:{4}", n.AbsoluteTime, n.CommandCode, n.Channel, n.NoteNumber, n.Velocity);
}
else if (e.MidiEvent is ControlChangeEvent)
{
   ControlChangeEvent c = (ControlChangeEvent)e.MidiEvent;
   message = String.Format("{0} {1} Ch: {2} Controller:{3} Value:{4}", c.AbsoluteTime, c.CommandCode, c.Channel, (int)c.Controller, c.ControllerValue);
}
MessageBox.Show(message); 

Viewing all articles
Browse latest Browse all 5831

Trending Articles