Reputation: 73
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
Upvotes: 2
Views: 3576
Reputation:
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;
}
Upvotes: 2
Reputation: 73
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 :
This is a best library i have founded for sound.
Upvotes: 0