This project has moved. For the latest updates, please go here.

How to split one mixed audio file to two separate files

Sep 28, 2010 at 7:08 AM

Hi all,

Is it possible to use NAudio lib to split one mixed audio file to two separate files of left channel and right channel?

I have been working on this for the whole day and have not found a way yet...

Any suggestion?

Thanks a lot!

 

Regards

Darren

Coordinator
Sep 28, 2010 at 10:35 AM

it is possible to use NAudio as the basis for this, but you would need to create your own WaveStream that thre away every other sample

Mark

Sep 28, 2010 at 10:41 AM

Thank you Mark, I will try it.

Sep 29, 2010 at 1:42 AM

Hi Mark,

I read the wavestream class, it seems this class only for reading wave file, right?

Basically I want to generate two files of left channel recording and right channel recording respectively.

My real case is: I need to record phone calls, and now I can use the NAudio to get caller and receiver's voice in one wave file by using:

waveIn.WaveFormat = new WaveFormat(8000, 2);

A strange thing is when I listen to the recording audio, one side is only caller's voice, another side is the voice mixed from both caller and receiver.. I don't understand why..

Can you please give some tips? 

Thanks a lot:)

Darren

Coordinator
Oct 5, 2010 at 7:18 PM

the byte array you receive from waveIn will consist of 2 bytes left channel, 2 bytes right channel and so on. So you just throw away every other pair of bytes.

Also, when writing to the WaveFile, make sure that you set a mono format, i.e. new WaveFormat(8000,1);

 

Mark

Oct 5, 2010 at 8:54 PM

Thanks a lot Mark, I thought its 4 bytes for each...and failed to split them.