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

Problem reading mu-law encoded audio

Nov 20, 2010 at 6:54 PM

Hello,

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!

Coordinator
Nov 21, 2010 at 8:58 AM

I've answered this on StackOverflow:

http://stackoverflow.com/questions/4234665/using-naudio-to-decode-mu-law-audio