Accessing the audio device directly

In addition to the Music and Sound interfaces Libgdx also provides two more low-level audio interfaces that enable direct access to the audio device. They can be used for recording and playback of raw samples of audio data. Those samples are stored as a PCM-encoded audio signal.


These direct access features are currently unavailable in HTML5/GWT applications.

Exploring the AudioDevice interface

The AudioDevice interface allows you to send PCM-encoded audio samples directly to the audio device. For this to work, a new audio device can be requested using Libgdx's module and called by its newAudioDevice() method as follows:

  AudioDevice audioDevice =, false);

The preceding ...

Get Learning Libgdx Game Development now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.