Resampling PCM audio windows store app

492 views Asked by At

With the help of following example code, I successfully wrote an application to capture microphone audio in PCM format. The following is the wave format of the captured PCM audio:

Channels = 2
FormatTag = Pcm
SamplesPerSecond = 44100
BitsPerSample = 32
BlockAlign = 8           
AverageBytesPerSecond = 352800

I want to resample the PCM audio to the following wave type:

Channels = 1
FormatTag = Pcm
SamplesPerSecond = 8000
BitsPerSample = 16
BlockAlign = 2              
AverageBytesPerSecond = 16000

Forums are saying that we can capture audio in CD quality only from windows store apps, is this true? Is it possible to convert the wave type of PCM audio in windows store app?

1

There are 1 answers

0
Ansis Māliņš On

Nothing of this has anything to do with "CD quality". And I don't think Windows Store is relevant to your question.

WASAPI uses the format of the sound card, whatever it is. Usually it's stereo, 16 bit, 44.1 or 48 kHz, but it could be anything.

You will have to write the resampler and design the low-pass filter yourself.

Are you sure WASAPI is the best match for your use case? Have you considered a higher level API (DirectShow or XAudio2) that handles resampling for you instead?