I would like to resample a IEEE floating point ISampleProvider at 44100Hz and get another ISampleProvider at 16000Hz, but I can't seem to get NAudio to do the conversion.
This is what I have tried so far.
var myReader = new AudioFileReader(filename);
var resampledAudio = new WaveToSampleProvider(
new MediaFoundationResampler(
new SampleToWaveProvider(myReader),
new WaveFormat(16000, 2)){ ResamplerQuality = 60 });
When I run this code I get an ArgumentException
with a message saying:
the input argument must already be floating point
Does anyone know how I can solve this issue?
You should solve your problem using this:
WaveFormat.CreateIeeeFloatWaveFormat(16000, 2);
Instead of:
new WaveFormat(16000, 2)