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

Problem reading mu-law encoded audio

Nov 20, 2010 at 7:54 PM


I'm attempting to use NAudio to decode mu-law encoded audio into pcm audio. My service is POSTed the raw mu-law encoded audio bytes and I'm getting an error from NAudio that the data does not have a RIFF header. Do I need to add this somehow? The code I'm using is:

WaveFileReader reader = new WaveFileReader(tmpMemStream);
using (WaveStream convertedStream = WaveFormatConversionStream.CreatePcmStream(reader))
WaveFileWriter.CreateWaveFile(recordingsPath + "/" + outputFileName, convertedStream);

I'm also saving the raw data to the disk and doing the decoding in Matlab which is working with no problem.

Thanks for the help!

Nov 21, 2010 at 9:58 AM

I've answered this on StackOverflow: