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

Wasapi format not supported

Oct 23, 2009 at 1:48 PM

Hi all,

has anyone ever tried to use the wasapi with a non MixFormat Waveformat? I try to get it working with 8kHz, 16bit and 1 channel without luck. I even changed the call to audioClient.IsFormatSupported to AudioClientShareMode.Exclusive but with the same result.

if (!audioClient.IsFormatSupported(AudioClientShareMode.Exclusive, WaveFormat))
    throw new ArgumentException("Unsupported Wave Format");

thanks in advance,


Oct 23, 2009 at 1:50 PM

hi Christoph,

I'm afraid that WASAPI limits your options to only those wave formats natively supported by the soundcard. It won't do any sample rate conversion for you. Personally, I think this was a mistake by Microsoft to leave this limitation in, meaning that very few apps will adopt the WASAPI interface.


Oct 23, 2009 at 2:56 PM

Hi Mark,

thanks for that info! It's really a shame that wasapi doesn't support any conversions.

Appart from wasapi, what s the API you would recommend for doing VoIP (so low latency is a issue)? NAudio supports a variety so its hard to decide which one to choose?


Oct 23, 2009 at 3:16 PM

Hi Christoph,

I'm afraid .NET is not a good choice for low latency audio (mainly due to the garbage collector). I would write it in C/C++ instead. You are not likely to get much below 50ms latency reliably with NAudio.


Oct 23, 2009 at 6:19 PM
Edited Oct 28, 2009 at 8:20 AM

I understand! From testing the latency is at least 500ms (two side recording and playback) what are the parameters to reduce the latency to a minimum? I can set the desired latency on the playback but without making any difference in the resulting latency also the buffer size settings on the recording side are changeable. Would that give me an improvement if I set it to the same frame size as the encoders requires?

I am sorry if I bother you with all that basic stuff :) but its quite hard to get a good source off information on that topic ! Also would you recommend Directsound over waveXXX for that purpose?


btw: I am using Naudio for that project ( where its used for accessing the soundcard before encoding and decoding it with Speex.

Oct 24, 2009 at 8:33 PM

when you are doing voip you have at least three sources of latency - recording latency, network latency and playback latency. It can add up very quickly. In NAudio the WaveIn and WaveOut let you specify buffer durations and the number of buffers used. You can try going down to two buffers (default is three) and making them shorter. Setting to the same frame size that the encoder requires might help a little as it saves cutting up and combining buffers.