tags:

views:

699

answers:

3

Hi,

I want to change an audio file format into another. Specifically, I want to convert any audio file into 6khz, 16 bit, mono, PCM wav format.

How can I cope with this problem.

Thanks again in advance.

+1  A: 

I'm not entirely sure whether you'll be able to do this as well as you may like.

To start with refer to the windows API for dealing with RIFF files (that's the file group for WAV files.)

You'll need to read the headers, extract the data and uncompress it to get the raw data format. I beleive that the header data will tell you what codec was used for compression.

You'll need to perform some processing on the raw data. Conversion to mono and 16bit may not be a problem, but I'm not too sure about changes to the sampling rate.

You can then recompress using your specified codec.

ChrisBD
Then you say that it would be difficult tot handle ? I see. Then I need to advance my search for goods.
Braveyard
and at least can you tell me which namespace,dll,classes whatever I'll need to implement the solution in my project.
Braveyard
I must admit that I didn't notice that you'd specified C#. I've only ever dealt with these files using VC++.I think that this link may help for C# as it looks as if there's a class for wav files:http://msdn.microsoft.com/en-us/library/aa446573.aspx
ChrisBD
+2  A: 

I would use the BASS Library. It has many possibilities to do format conversions using the built in encoding/decoding capabilities. It also has a .NET wrapper availabe.

Magnus Johansson
+3  A: 

You can also do this using the open source C# audio library NAudio. Have a look at the NAudioDemo project for an example of passing WAV files through the ACM codecs installed on your machine to convert to another format. If your input file is not WAV or MP3, you will first need something that converts it to WAV though.

Mark Heath
Sounds good to me.
ChrisBD
Actually I was waiting an answer like including Microft Native .NET libraries. But I really need to use another API ?
Braveyard