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

Playing header-less / RAW ADPCM

Jan 10, 2014 at 7:23 PM
Edited Jan 10, 2014 at 7:28 PM
I have some raw ADPCM data that I'm playing with in firmware binaries and am working on a C# app to browse and play that data using NAudio. I've been able to extract and play the audio in Audacity, importing as raw VOX ADPCM data at various sampling rates (defined elsewhere in the file). The files also contains 24bit PCM audio which I'm able to play just fine. My question is, how can I use NAudio to play raw ADPCM?

I've tried the following and get nothing but silence:
WaveOut waveout = new WaveOut();
AdpcmWaveFormat format = new AdpcmWaveFormat(rate, 1);
Stream stream = new MemoryStream(file.sfdata, record._offset, record._size);
RawSourceWaveStream rawstream = new RawSourceWaveStream(stream, format);
WaveStream wavestream = WaveFormatConversionStream.CreatePcmStream(rawstream);
waveout.Init(wavestream);
waveout.Play();
My 24bit PCM routine plays just fine as this:
WaveOut waveout = new WaveOut();
WaveFormat format = new WaveFormat(rate, 24, 1);
Stream stream = new MemoryStream(file.sfdata, record._offset, record._size);
RawSourceWaveStream rawstream = new RawSourceWaveStream(stream, format);
waveout.Init(rawstream);
waveout.Play();
EDIT: I tried using a WaveWriter off wavestream for the ADPCM routine and the resulting file just had the .wav header information in it. When checking wavestream in the debugger, the length and time looks correct for what the data should be converted as.
Coordinator
Jan 11, 2014 at 10:07 AM
there are a number of different types of ADPCM. The WaveFormat structure must be exactly right for ACM to decode it properly. So you may need to find out more about what exact incoming format is being used and experiment with custom WaveFormat structures.
Jan 11, 2014 at 2:35 PM
What format is expected when using the AdpcmWaveFormat class to define the format? Is there a header I need to insert at the beginning of the stream? I tried creating various custom formats but didn't have much luck. I'll dig into custom WaveFormat structures more.