How to mute or select only one audio channel?

1k views Asked by At

I'd know how can I mute or select only one audio channel in C#. I have to play an audio file only in the left/right channel. Is it possible? What do I have to do?

2

There are 2 answers

1
Kip Morgan On BEST ANSWER

You will likely need to use the Balance property of System.Windows.Media.MediaPlayer.

MSDN MediaPlayer Balance Property

Set it to -1 for the left and 1 for the right channel.

    MediaPlayer mediaPlayer = new MediaPlayer();

    private void Button_Click(object sender, RoutedEventArgs e)
    {
        mediaPlayer.Open(new Uri(@"C:\temp\Kalimba.mp3"));

        if (DateTime.Now.Second % 2 == 0)
        {
            mediaPlayer.Balance = 1;
            mediaPlayer.Play();
        }
        else
        {
            mediaPlayer.Balance = -1;
            mediaPlayer.Play();
        }
    }
0
abc On

System.Media.SoundPlayer lacks the possability of adjusting the balance. You should try something different. System.Media.SoundPlayer simply controls playback of a sound from a .wav file