Home:ALL Converter>MIDI sound only in one channel (left or right)

MIDI sound only in one channel (left or right)

Ask Time:2018-04-24T03:28:15         Author:Michael280

Json Formatter

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#?

Author:Michael280,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/49988591/midi-sound-only-in-one-channel-left-or-right
yy