wasapi-development

Design, implement, and debug WASAPI and Core Audio streams on Windows 10 and 11.

3|Updated Aug 8, 2026
One-click install
npx skills add https://github.com/Jose-Polanco-Oxte/Echos-Live-Music-Visualizer --skill wasapi-development-jose-polanco-oxte
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wasapi-development
Source: https://github.com/Jose-Polanco-Oxte/Echos-Live-Music-Visualizer/tree/main/.agents/skills/windows/sub-skills/wasapi-development
Command: npx skills add https://github.com/Jose-Polanco-Oxte/Echos-Live-Music-Visualizer --skill wasapi-development-jose-polanco-oxte

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Windows audio development with WASAPI involves real-time buffer protocols, COM threading rules, format negotiation, and device-change recovery that are easy to get wrong, causing glitches, underruns, and crashes. This Skill provides structured guidance for building correct, low-latency audio capture, render, and loopback streams. ## Core Features & Use Cases - Stream Implementation Guidance: Covers render, capture, endpoint loopback, and process loopback scenarios using IAudioClient/IAudioClient3, IAudioRenderClient, and IAudioCaptureClient with correct GetBuffer/ReleaseBuffer pairing. - Latency and Scheduling Control: Explains shared vs exclusive mode, event-driven streaming, period negotiation, and MMCSS scheduling for glitch-resistant real-time audio. - Device and Error Recovery: Details MMDevice endpoint selection, IMMNotificationClient change handling, and recovery from AUDCLNT_E_DEVICE_INVALIDATED and related errors. - Use Case: When adding system loopback capture to a WinUI 3 audio visualizer, use this Skill to negotiate the mix format, set up an event-driven capture loop, and handle device unplug/replug without crashing. ## Quick Start Use the wasapi-development skill to implement a shared-mode event-driven loopback capture stream in my C# Windows app with proper device-invalidation recovery.

Frequently Asked Questions about wasapi-development

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I capture system audio with WASAPI loopback?

WASAPI loopback capture initializes a shared-mode stream on a render endpoint with AUDCLNT_STREAMFLAGS_LOOPBACK, then reads packets through IAudioCaptureClient. Loopback is not supported in exclusive mode, and event-driven loopback works natively on Windows 10 version 1703 and later.

How do I capture audio from a specific process on Windows?

Use process loopback via ActivateAudioInterfaceAsync with AUDIOCLIENT_ACTIVATION_PARAMS and PROCESS_LOOPBACK_MODE_INCLUDE_TARGET_PROCESS_TREE or EXCLUDE mode. This requires Windows 10 build 20348 or later, so verify the app's minimum OS version first.

Should I use shared mode or exclusive mode in WASAPI?

Shared mode is the default choice because it coexists with other apps and supports loopback. Use IAudioClient3 on Windows 10+ for low-period shared streams; reserve exclusive mode for bit-exact output or verified latency requirements shared mode cannot meet.

Why does my WASAPI stream fail when I unplug the audio device?

Unplugging invalidates the stream, returning errors like AUDCLNT_E_DEVICE_INVALIDATED or AUDCLNT_E_RESOURCES_INVALIDATED. Handle these as normal runtime states: stop the client, release services, re-resolve the endpoint, and reinitialize with bounded retries.

Can I use WASAPI from C# and .NET applications?

Yes, but keep native resource ownership explicit, dispose COM resources deterministically, and avoid allocations, LINQ, and heavy logging in the buffer-processing hot path. Keep the UI thread independent from the audio thread and marshal UI updates at a lower rate.

Why does WASAPI capture return silent or discontinuous packets?

Capture packets can carry AUDCLNT_BUFFERFLAGS_SILENT, DATA_DISCONTINUITY, or TIMESTAMP_ERROR flags that must be inspected. Treat silent packets as zero-valued frames and propagate discontinuities to any component relying on continuous timing or signal history.