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

Upconvert WAV sample rate

Mar 30, 2012 at 9:46 PM

I have a WAV file at 8000 samples/sec and 8 bits per sample.  It's stored as a C# byte array in memory.

It needs to be converted to a 16000 samples/sec, 16 bits/sample WAV.  The converted WAV can be either a byte array or a MemoryStream.

I've tried using WaveFileWriter.WriteData with the new format (the output is high pitched and garbled), WaveFileWriter.WriteSamples (confusing; apparently it needs floats but I have bytes), WaveFormatConversionStream (this doesn't seem to produce a valid WAV - there's no "RIFF" in the header).

If this possible?  Is there an easy to follow sample somewhere?


Apr 2, 2012 at 8:44 AM

You can use WaveFormatConversionStream to upsample, or convert from one bit depth to another. It seem likely that your original audio was a-law or u-law, so your conversion to 16kHz 16 bit would need to be done in two stages.