Author image

Minimal XAudio v2.8 Windows library


A high performance minimal XAudio 2.8 based library developed from scratch. It is almost as low level as one can get in Windows; such is the nature of XAudio2. I made it to use it in a Direct3D game engine but it doesn't require Direct3d and can be used for whatever purpose on the Windows platform.

XAudio2 delegates sounds to the WASAPI backend. You don't need multiple threads for each playing sound; these are managed internally by WASAPI which mixes & matches them internally as it best sees fit.

I used:

  • Windows 8.1 x86_64, Microsoft Visual Studio 2017
  • XAudio v2.8
  • X3DAudio

If you're on Windows 10 you can use XAudio v2.9 dll without much, if any, change.

If you'd prefer a more graphical approach, I have a QT audio player project.


SoundManager is a singleton audio instance.

There is a maximum number of sound channels, which I have hardcoded to 64. But make sure that your hardware sound card can also support this.

You can find examples in main.cpp of how to create and play sounds.

  1. Create sound object: Sound mySound{filePath, soundName, soundCategory = L""};
  2. Play it: volume = 1.0f );
  3. Stop it: mySound.stop()

You can optionally provide a sound category (known as submix voice) as the third argument in the constructor, for example “sfx”, “music”, “ambience” etc. You can have up to 8 submixes (experimental - it should be possible to use more).

Only .wav sounds are supported. I do not intend at the moment of supporting other audio formats. Note that your .wav file should have 2 or more channels (Stereo) with 16 bits per sample. It is recommended that the samples per second be 48KHz. If this is not the case then the audio will sound accelerated or decelerated.

Known bugs

After you stop a sound, you can't play it again. I'll have to look more into why this is happening. Or if you find out let me know!

Contribute by submitting any bugs you find through GitHub repository 'Issues' page with details describing how to replicate the problem.


  • Sound looping
  • Sound pausing & continuing
  • Support more sample rates and configurations


Github repository link.


All demo sounds are in the public domain from