The sound of music

We now turn to the audio soundtrack for our game. Just like a movie soundtrack, the music that is played during a game sets the tone for the game. Many games have huge, orchestrated productions, while others have synthesized or 8-bit music.

As we have already discussed, music files are handled in a different manner from sound effects. This is because sound effects are usually very short sounds that can be best stored as wav files. Music files tend to be much longer, and are stored as MP3 files because the data can be compressed, taking less storage and less memory.

We are going to add a single music track to our game. To keep things simple, we will tell the track to loop so that it runs continuously throughout the game.

We will ...

Get OpenGL Game Development By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.