I used this code to resample file and save it but the file sounds like fast-forward recording:
using (MediaFoundationReader reader = new MediaFoundationReader(url))
{
using (ResamplerDmoStream resampledReader = new ResamplerDmoStream(reader, new WaveFormat(16000, 16, 1)))
{
using (WaveFileWriter waveWriter = new WaveFileWriter(@"c:\test.wav", resampledReader.WaveFormat))
{
resampledReader.CopyTo(waveWriter);
}
}
}
The
WaveFileWriter
must have the sameWaveFormat
asresampledReader
. So pass inresampledReader.WaveFormat
to theWaveFileWriter
constructor.