Introduction

libGDX provides methods to playback small sound effects as well as stream larger music pieces directly from disk. It also provides convenient read and write access to the audio hardware. audio module, referenced by:

  1. Audio audio = Gdx.audio;

libGDX will automatically pause and resume all audio playback for you if your application is paused and resumed.

Audio on Android

SoundPool API to play Sounds and the MediaPlayer for Music. These API have some limitations and known issues in certain scenarios:

  • AsynchronousAndroidAudio by implementing createAudio()on AndroidLauncher like this:
    1. @Overridepublic AndroidAudio createAudio(Context context, AndroidApplicationConfiguration config) { return new AsynchronousAndroidAudio(context, config);}
    Generally speaking, Audio on Android is problematic and there may be other scenarios or device especific issues. Oboe that can be used on libGDX projects thanks to libGDX Oboe.