Take the 2-minute tour ×

I need to downsample a 16000 hz PCM 16 bit wave file to 8000 hz. I dont have much knowledge(almost no) on audio processing, i just understand bits, bytes, shifting etc as all programmers understand.

It is a Windows Phone application.

What do you suggest? Also as far as i understand SampleRate of Microphone class in XNA framework is not customizable such that it only gives you 16000 hz data. Is there a way to get 8000 hz raw audio data in Windows Phone? That would be a much easier solution :)

Thank You.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

If you won't find a good solution and will have to proceed with own conversion the following may help you.

Assume you use XNA framework microphone+wav like below: http://damianblog.com/2011/02/07/storing-wp7-recorded-audio-as-wav-format-streams/

Then to get 8khz instead of 16khz you just need to drop every second value from the data returned in microphone.BufferReady event. Or it is better to use interpolation (instead of dropping every second value you saves average of two values)

for (int i=0; i < arr.length/2;i++) res[i] = (arr[2*i]+arr[2*i+1]))

Also don't forget to set correct value for sampleRate (8000) in WriteWavHeader function

share|improve this answer
Dropping every other value will cause aliasing. A low-pass filter should be applied first. –  Phonon Jan 4 '13 at 1:54
add comment

Your Answer


