I have an WPF application which need to play MIDI sound but only in one channel - on left or right headset channel.
I have a piece of a code that plays a MIDI note (in both channels), however I don't know how to modify it to play the MIDI sound ONLY on the RIGHT or ONLY on the LEFT channel.
This is my code:
public static class MidiNote
{
public static MidiOut MidiOut = new MidiOut(0);
public static void PlayNote(int key, int duration)
{
MidiOut.Volume = 65535;
MidiOut.Send(MidiMessage.StartNote(key, 127, 1).RawData);
Thread.Sleep(duration);
MidiOut.Send(MidiMessage.StopNote(key, 0, 1).RawData);
}
}
I found some partial answers but I do not know how can I use them. I read these two articles:
Play sound on specific channel with NAudio
How to play sound only on the left channel of the headphone and only on the right channel of the headphone in c#?