I have a file with no header with IMA ADPCM raw data stored, I would like to play it using NAudio. In Audacity, using this config plays without problems:
Encoding: VOX ADPCM
Byte order: No Endianness
Channels: 1 Channel (Mono)
Start offset: 0 bytes
Amount to import: 100%
Sample rate: 22050Hz
This is the code I'm using, but I always get a System.DivideByZeroException error.
internal void PlayIMAAudio(WaveOut AudioPlayer, byte[] IMAData, int Frequency, int Bits, int Channels)
{
if (AudioPlayer.PlaybackState == PlaybackState.Stopped)
{
MemoryStream AudioSample = new MemoryStream(IMAData);
ImaAdpcmWaveFormat FileFormat = new ImaAdpcmWaveFormat(Frequency, Channels, Bits);
RawSourceWaveStream provider = new RawSourceWaveStream(AudioSample, FileFormat);
AudioPlayer.Init(provider);
AudioPlayer.Play();
}
}
How could I fix it?
Thanks!