Skip to content
minimal cross platform 16bit stereo PCM output
C++ Lua Shell Java
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


tinyaudio provides a cross-platform interface for sending 16-bit stereo PCM data to the device's audio hardware.

tinyaudio does NOT provide any type of mixing (gain, voice, panning, playback) support. I do provide another library (tinymixer) that provides a "normal" audio interface for a game project. The two projects are meant to work together; For sanity I keep tinymixer free from all platform specific code.

Current support exists for:

  • Windows (xaudio)
  • Chrome NativeClient
  • null driver
  • Linux (ALSA)
  • Linux (pulse)




Copyright 2011-2013 Matthew Endsley

This project is governed by the BSD 2-clause license. For details see the file titled LICENSE in the project root folder.

Integrating with your codebase

The easiest way to integrate tinyaudio into your project is to simply include the appropriate .cpp file inside of /src/ directly in your project.

Alternatively you can compile your platform's driver .cpp into a static library and link it.

For AirMech I literally have the following code in sound/compile/device.cpp:

#	include <tinyaudio_xaudio.cpp>
#	include <tinyaudio_nacl.cpp>
#	include <tinyaudio_null.cpp>

Including a .cpp file directly may feel dirty, but it's a heck of a lot easier than managing another 3rdparty pre-built library.

How to use tinyaudio in your game

Simply call tinyaudio::init with a callback handler to generate 16bit stereo PCM data. tinyaudio will invoke your callback when data is needed by the hardware. Simply fill the buffer in a timely manner to avoid audio lag.

Platform drivers

src/tinyaudio_alsa.cpp ALSA support for Linux
src/tinyaudio_android.cpp Support for Android native applications
src/tinyaudio_nacl.cpp Support for 32/64bit NativeClient applications
src/tinyaudio_null.cpp Null implementation of the interface
src/tinyaudio_pulse.cpp Pulse audio support for Linux
src/tinyaudio_xuadio.cpp Support for XAudio2 on Windows or XBox360

You can’t perform that action at this time.