Ya,i tried the way you said.but still i am getting the same error .
public ImaAdpcmWaveFormat(int sampleRate, int channels, int bitsPerSample,int sperblock)
{
this.waveFormatTag = WaveFormatEncoding.DviAdpcm; // can also be ImaAdpcm - they are the same
this.sampleRate = sampleRate;
this.channels = (short)channels;
this.bitsPerSample = (short)bitsPerSample; // TODO: can be 3 or 4
this.extraSize = 2;//
this.blockAlign = 256; //TODO
this.averageBytesPerSecond = 4055; //TODO
this.samplesPerBlock = (short)sperblock; // TODO
}
Above values which i am assigning are same as NaudioDemo Application values.
Format 0: 8.000 kHz, 4 Bit, Mono FormatTag: DviAdpcm, Support Flags: Codec WaveFormat: DviAdpcm 8000Hz Channels: 1 Bits: 4 Block Align: 256, AverageBytesPerSecond: 4055 (32.4 kbps), Extra Size: 2 Extra Bytes: F9 01
In my code i wrote like this,
convertedStream = New WaveFormatConversionStream(New ImaAdpcmWaveFormat(8000, 1, 4, 2048), Reader) WaveFileWriter.CreateWaveFile(CurrentFile, convertedStream)
Since Extra Bytes in Hexa Decimal,i converted it into Decimal.