2
votes

I want to play a stereo sound in the following manner using c#.net

It’s a stereo track: Make it possible to hear only the L or only the R channel or both channels simultaneously. If you play only on channel put the audio out in mono so that you can hear the one channel in either speakers or headphones

Thanks in advance for any help

2
Somewhere i read that we can do this by VLC player.By select Audio-> Audio Channels -> Right or Left . But ,how can i do this via programming in c#. Is there anybody who can help me ??SR Dusad

2 Answers

2
votes

In Alvas.Audio you need use AudioCompressionManager.MergeStereo and AudioCompressionManager.SplitStereo methods

See pseudo code below

    AudioCompressionManager.SplitStereo(stereo, left, right);

    PlayerEx plex = new PlayexEx(); 
    plex.Done += new PlayerEx.DoneEventHandler(plex_Done);   
    plex.OpenPlayer(format);      
    plex.StartPlay();

    enum State {    Left,    Right,    Both }

    void plex_Done(object sender, DoneEventArgs e) {    
      byte[] left50ms = Cut(left, 50);    
      byte[] right50ms = Cut(right, 50);    
      switch (State)    {
        case State.Left:
          plex.AddData(AudioCompressionManager.MergeStereo(left50ms, left50ms));
        break;
        case State.Right:
          plex.AddData(AudioCompressionManager.MergeStereo(right50ms, right50ms));
        break;
        case State.Both:
          plex.AddData(AudioCompressionManager.MergeStereo(left50ms, right50ms));
        break; 
}
0
votes

I found the solution for this .

I have found a library named zLib . U can use this library for play audio,Mix channels and many others . This library is very usefull for sound related work and written in many languages like VC++,C#.Net,VB.Net etc. Goto the below link :

zLib for Sound Work

This is a best library i have founded for sound.