WASAPI

Also known as: Windows Audio Session API

On this page 8

WASAPI (the Windows Audio Session API) is the low-level programming interface through which applications send audio to and receive audio from endpoint devices in Windows. Introduced with Windows Vista as part of the Core Audio APIs, it sits directly above the audio engine and the device drivers, and every higher-level audio interface in modern Windows, from DirectSound to XAudio2 and Media Foundation, ultimately passes its samples through it.

WASAPI matters in Windows fundamentals because it defines how the operating system shares one sound card among many programs, how it controls latency, and how professional or audiophile software can bypass system mixing entirely through exclusive mode.

How WASAPI moves audio between applications and devices

WASAPI works by giving each client an audio stream inside an audio session, backed by a shared memory buffer that the client fills or drains in regular device periods. An application enumerates devices through the IMMDeviceEnumerator interface, activates an IAudioClient on the chosen endpoint, initializes it with a format and buffer duration, and then writes frames through IAudioRenderClient or reads them through IAudioCaptureClient.

In the default path, the Windows audio engine (hosted in the audiodg.exe process) mixes all shared-mode streams, applies sample-rate conversion, volume and audio processing objects such as enhancements, and hands the result to the driver. The engine usually runs with a 10 ms period, which is the main source of shared-mode latency.

The following table lists the main components a WASAPI client touches and the role each one plays.

ComponentRoleTypical use
IMMDeviceEnumeratorLists audio endpointsFinding the default speakers or microphone
IAudioClientCreates and configures a streamChoosing mode, format and buffer size
IAudioRenderClientWrites output framesPlayback of music or game sound
IAudioCaptureClientReads input framesRecording from a microphone
ISimpleAudioVolumeControls session volumePer-application volume in the Volume Mixer
Core components used by a WASAPI client

Shared mode and exclusive mode

WASAPI offers two stream modes that trade convenience against control. In shared mode, the stream goes through the audio engine and must use the engine’s mix format, usually 32-bit floating point at the sample rate set in the Sound control panel, although clients can request automatic conversion. In exclusive mode, a single application takes the endpoint for itself, the engine is bypassed, and the client must supply a format the hardware supports natively.

Exclusive mode is the basis of bit-perfect playback claims, because no resampling, mixing or volume scaling alters the samples. The cost is that system sounds and other applications fall silent while the stream is open, unless the user disables exclusive access in the device properties.

PropertyShared modeExclusive mode
Mixing with other appsYes, through the audio engineNo, one client only
Sample formatEngine mix format or convertedNative device format
Typical latencyAbout 20-30 ms round tripAbout 3-10 ms output
Signal processingEnhancements and volume appliedBypassed
Main usersBrowsers, games, communicationsAudiophile players, audio workstations
Comparison of WASAPI stream modes

Latency, buffering and event-driven streams

WASAPI latency depends on the buffer duration, the device period and whether the client uses event-driven or timer-driven scheduling. In event-driven mode, set with the AUDCLNT_STREAMFLAGS_EVENTCALLBACK flag, Windows signals an event each time the buffer has space, which allows smaller buffers without glitches. Timer-driven clients poll with GetCurrentPadding and need extra headroom.

Since Windows 10, the IAudioClient3 interface lets shared-mode clients request periods shorter than 10 ms when the driver supports them, which narrowed the gap between shared and exclusive mode. Pro-audio threads should also register with the Multimedia Class Scheduler Service so the scheduler gives them real-time priority.

The values below are typical ranges; actual results depend on the driver, the hardware and system load.

ConfigurationPeriodPractical effect
Shared, default engine10 msSafe for media playback
Shared, IAudioClient3 low latency2.67-10 msBetter for voice and games
Exclusive, event-driven3-5 msSuitable for live monitoring
Exclusive, timer-driven10 ms or moreStable but slower response
Typical WASAPI buffer configurations

WASAPI compared with other Windows audio interfaces

WASAPI is the foundation layer of Windows audio, while other interfaces either wrap it or bypass the Windows audio stack. Developers choose among them by weighing ease of use, latency and portability. ASIO, a third-party driver standard from Steinberg, remains common in music production because many audio interfaces ship dedicated ASIO drivers with very low latency.

InterfaceRelation to WASAPIBest suited for
DirectSoundLegacy API emulated on top of WASAPIOlder games and applications
XAudio2Game audio engine using WASAPI outputGames with 3D sound and effects
Media FoundationMedia pipeline that renders through WASAPIVideo and music playback apps
ASIOSeparate driver path that bypasses WASAPIRecording studios and DAWs
WaveOut / MMEOldest API, mapped onto WASAPISimple legacy programs
Windows audio interfaces and their relation to WASAPI

Practical use and configuration

Users rarely see WASAPI directly, but many audio players and workstations expose it as an output option. Choosing WASAPI exclusive mode in a music player is the usual way to get unaltered output to an external DAC, while shared mode is the right choice whenever several applications must play sound at the same time.

  • Set the default format in the device properties to match the most common source material to reduce resampling in shared mode.
  • Enable or disable Allow applications to take exclusive control in the device’s Advanced tab to permit or block exclusive streams.
  • Use loopback capture with the AUDCLNT_STREAMFLAGS_LOOPBACK flag to record what a render endpoint is playing.
  • Handle device change notifications through IMMNotificationClient so streams survive headphones being unplugged.

Limitations and common mistakes

Most WASAPI problems come from format mismatches and underrun handling. A client that writes too little data per period produces audible clicks, and an exclusive-mode request with an unsupported format fails with AUDCLNT_E_UNSUPPORTED_FORMAT rather than being converted automatically.

  • Assuming exclusive mode always sounds better: with a correct mix format, shared mode can be transparent for most listening.
  • Forgetting that endpoint invalidation occurs when a device is removed, which requires a new stream.
  • Running the audio thread at normal priority, which causes glitches under load.
  • Expecting WASAPI to offer multi-client low latency on drivers that only support the 10 ms default.

In plain words

WASAPI is the doorway between a program and the speakers or microphone on a Windows computer. Every app that plays sound uses it, either directly or through another tool. It decides how sound reaches the hardware.

Normally, Windows acts like a mixing desk. It blends sound from the browser, a game and a chat app into one stream. This is shared mode. Exclusive mode is different. One program gets the speakers all to itself, and the sound passes through untouched. The trade-off is simple: sharing is convenient, exclusive access is purer and faster.

A real-world example

A podcast producer records interviews on a Windows 11 laptop with a USB audio interface. During recording, the editing software opens the interface through WASAPI exclusive mode with a 5 ms event-driven buffer, so the host hears the microphone in the headphones with no distracting echo. Notifications and the browser are silent during the session, which also keeps unwanted sounds out of the monitor mix.

After recording, the producer switches the software back to shared mode to review edits while a video call runs in parallel. Both applications now play through the audio engine at a 48 kHz mix format. The result is low-latency recording when it matters and convenient multitasking for everything else, with one setting changed in the audio preferences.