Reading a 16kHz WAV file

Oct 21, 2009 at 3:48 PM

Hi folks, 

I am new to this API and have been struggling to use the mixer to mix down two wav files.  I think I am close, but I have hit an issue.

I open both files using a WaveFileReader and right away I see that the WaveFormat is not correct.  Regardless of the input file, the WaveFormat on the WaveFileReader object has a sample rate of 44.1kHz and 2 channels.  One of the wav files I am using is sampled at 16kHz and only mono (1 channel).

I thought I could set the WaveFormat somewhere but this seems to be a read only property. 

Any thoughts?

Joe

Coordinator
Oct 22, 2009 at 2:09 PM

Hi Joe,

The WaveFileReader reads the wave format out of the WAV file itself. You need to set the wave format correctly when you create the file with WaveFileWriter (assuming you created it yourself)

Mark

Oct 22, 2009 at 3:03 PM

Hi Mark,

Thanks for the answer.  I do not create the wav, so I can't change the format it is in.  However I did solve my problem by converting the wav to the proper format using code I found here.  http://mark-dot-net.blogspot.com/2008/11/using-naudio-to-replace-babysmash-audio.html  

Joe