Sample rate conversion for WasapiCapture

Feb 24, 2010 at 7:15 PM

Hi,

I would like to know if there is a way to add sample rate conversion to recording using WASAPI. I have already learned that WASAPI is generally not SRC-friendly, but I have seen that the ResamplerDmoStream is used by the WasapiOut class to do on-the-fly conversion, and I'm wondering if something similar could be done with the WasapiCapture as well.

Even if it's not implemented in the class itself, there should be a way to connect the ResamplerDmoStream to the WasapiCapture...? If the WasapiCapture was an IWaveProvider it would be easy but unfortunately it's not. I was also looking for a straightforward way to move data to the Resampler in the DataAvailable event of the Capture, but what would I construct the Resampler on then...? Some kind of a generic WaveStream I would guess, but I haven't found such a class. What I'm essentially missing is a stream that represents the WasapiCapture or to which I can write the captured audio data.

Maybe someone has an idea if the above is possible without too much hassle...? Thanks in advance!

 

Regards,

Michael

Coordinator
Mar 25, 2010 at 4:16 PM

yes, one of the most requested features for NAudio is something that turns an IWaveIn (WASAPI, WaveIn capture etc) into an IWaveProvider. Hopefully I'll get a chance to build one in the not too distant future

Mark