Book Image

LibGDX Game Development By Example

By : James Cook
Book Image

LibGDX Game Development By Example

By: James Cook

Overview of this book

Table of Contents (18 chapters)
LibGDX Game Development By Example
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Let's make some noise


So far, across all the games we have made, we can note that they all have something in common. They are completely silent! As any good game-maker knows, sounds and music add an awful lot to the experience. What we are going to look at now is how to use LibGDX to introduce sounds to our simple platform.

Before we dive into coding up some beeps and boops, let's first look at how LibGDX handles making sounds!

Sound effects

LibGDX splits the handling of audio into two parts. The first part is the sound effects with smaller audio files and the second part is the music, which generally has larger audio files. We will start off with looking at the Sound class of LibGDX, the one that looks after the smaller sound effects.

According to the LibGDX wiki (https://github.com/libgdx/libgdx/wiki/Sound-effects), the definition of which audio falls in the sound effects category is:

Sound effects are small audio samples, usually no longer than a few seconds, that are played back on specific...