This project has moved and is read-only. For the latest updates, please go here.

Mixing wave files with different sampling-rates?

Mar 25, 2010 at 2:41 PM

Hi, as the title dictates, I want to mix wave files with different sampling-rates. How can I achieve that in NAudio? I managed to mix those wave files using Audacity. Though, I need to automate the procedure. So, could you please help me achieve that? I have another question, is it possible to read raw adpcm data using NAudio? Thanks a lot for your time.

Mar 25, 2010 at 5:00 PM

Audacity will mix the files by converting them both to the same sample rate (by default this is likely to be 44.1kHz). You can use the WaveFormatConversion stream or the DMO Resampler object in NAudio to perform resampling.

NAudio can also convert ADPCM to PCM using ACM codecs installed on your PC.



Mar 25, 2010 at 6:03 PM

Thanks for the reply, Mark. The ADPCM files I am trying to convert are headerless. I have already tried the suggested

WaveFormatConversionStream.CreatePcmStream method,

on your blog but it could not detect the files. So, is there any way of processing those?

Mar 25, 2010 at 6:07 PM

what you do is to create a derived class from WaveStream. In the WaveFormat property, return a correctly formatted ADPCM WaveFormat (this is a pain because they contain a bunch of coefficients). In the Read method, simply read out of your headerless ADPCM files.

then you can pass that derived class into the WaveFormatConversionStream



Mar 25, 2010 at 7:49 PM

return a correctly formatted ADPCM WaveFormat (this is a pain because they contain a bunch of coefficients)

Any resources or documents on this, I can read?

Mar 26, 2010 at 10:38 AM

have a look at AdpcmWaveFormat in NAaudio. It might just do what you need. However, there are other ADPCM codecs that have different WAVFORMAT structures out there.


Mar 26, 2010 at 6:51 PM

Thanks, Mark. Will check that out.