This project has moved and is read-only. For the latest updates, please go here.

Quality of converted wav

Dec 16, 2009 at 3:40 PM
Edited Jan 4, 2010 at 12:29 PM

Hi Folks,

I am having trouble using the WaveFormatConversionStream.  I am trying to convert one WAV to another WAV with a higher sample rate, and I am hearing a significant loss of quality. 

The original is:

Bit Rate:          245kbps
Sample Size:   16 bit 
Channels        1
Sample Rate   16 kHz
Audio Format  PCM

The code I am using is below, I have a WPF app that has buttons corresponding to the methods here.  Just to be clear, I hear the output both times, just that the original sounds MUCH better than the converted one.  The converted one almost sounds like the microphone was clipping, but that is not the case since the original is fine. 

       private void InitWave()
           originalStream = new WaveFileReader(@"C:\temp\waves\original.wav");
private void btOriginal_Click(object sender, RoutedEventArgs e)

        private void btConverted_Click(object sender, RoutedEventArgs e)         
		WaveFormat format = new WaveFormat(44100,16,originalStream.WaveFormat.Channels);
		WaveStream w1 = new WaveFormatConversionStream(format, originalStream);
	private void PlayWaveStream(WaveStream stream)
		using (WaveOut waveOut = new WaveOut(WaveCallbackInfo.FunctionCallback()))
			while (waveOut.PlaybackState == PlaybackState.Playing)

 Any ideas as to what I am missing or what I can try to improve the quality of the conversion would be appreciated.  I have tried to use a BlockAlignReductionStream as well but no difference.



Dec 30, 2009 at 10:42 PM


I'm new to nAudio, but I think your problem is that WaveFormatConversionStream is using the Audio Compression Manager to change the sample rate. It is unlikely to be doing resampling which is what is required.

Take a look at the ResamplerDMOStream. Not sure, but this may do proper resampling rather than just averaging samples. Even with proper resampling, you will get some degredation in quality when up-sampling.

Hope this helps.




Dec 31, 2009 at 12:11 PM

Hi Joe,

ACM should be able to convert sample rates with no problem. I'm not sure exactly what is going on. Perhaps instead of playing the WAV file you could convert it to another WAV file at 44.1kHz.

Then try playing that file to see if there is any distortion.


Jan 4, 2010 at 12:32 PM

@matt69 - thanks for the suggestion, I will give this a shot.

@markheath - I think my code was mis-formatted and so hard to read, but I believe I am already trying to do what you are suggesting and this is the issue.  Can you let me know if I misunderstood what you meant?



Jan 4, 2010 at 4:38 PM

what I mean is, instead of playing the WAV file, use WaveFileWriter.CreateWavFile to make a new WAV file and see if that is converted correctly by playing it with windows media player. This is just to narrow down where the problem is (in conversion or in playback).

Jan 4, 2010 at 4:41 PM

I see what you mean.  I have tried both playing and creating the wav file to disk but the result is the same. 

Jan 8, 2010 at 11:57 AM

can you upload an example of your source file, so I can try to convert it myself?