What audio format should I use for my game?
Good question! I'm glad you asked.
Basically, you have 5 choices when it comes to selecting an audio format for your game.
In this little guide, I'll explain the 5 choices, so you can get a better idea of what your options are, and what the advantages and disadvantages for your choice are.
You can also skip the descriptions, and jump right to IndieGameMusic's recommendation.
flac and wav
Lossless streamed audio.
Advantages
- Quality can't get better than this.
Disadvantages
- Huge enourmous file-size!
- You have very limited control of the music.
Platforms
- PC and console.
mp3 and ogg
Compressed lossy streamed audio.
Advantages
- Smaller file-size than the lossless formats.
- Most platforms have native support for playing these files, meaning it is the easiest format to use.
Disadvantages
- Still requires a lot of space, resulting in game-developers on more limited platforms often settling for short 1-minute long tracks, when using these formats.
- The mp3 files are incapable of performing a smooth loop. (Only ogg can do this).
- You have very limited control of the music.
Platforms
- Most
it, xm, s3m and mod
Tracker formats, consists of instrument data in a streamed audio format, combined with notation data.
Advantages
- Smaller file-size than the lossy streamed formats, while not being a lossy format itself.
- Gives you much more control of the music:
- Change tempo without affecting the pitch.
- Jump to other places in the music with a 100% smooth transition.
- Make things happen in your game when certain notes are played in the music.
- One file can contain several tracks that all re-use the same instrument data. This means that one file of e.g. 1-2 mb can contain all the music for the whole game!
- Depending on how the track was made, it can give a better quality than the mp3 version while still taking up only 10% of the space.
Disadvantages
- Depending on how the track was made, it can give a lower quality than the mp3 version.
- Mostly requires a 3rd party player library, which means it's not as easy to get playing as an mp3/ogg, since you have to download such a lib and copy to your project.
Platforms
- All platforms for which a player library has been developed. Too many to list them all. Ask your developer community for a MOD/XM playerlib. There's a 99% chance at least one exists. Some examples:
- For Android there's AndModPlug and BASS
- For iOS there's ChibiXM and BASS
- For Flash there's hxmikmod and Flod
- For Javascript there's WebXmp and others
- For Java there's OZMod
- Generic C/C++ libs: libopenmpt, libxmp, BASS, Milkytracker lib
- For Atari Jaguar there's U-235
- For Nintendo 64 there's an XM player on the way
midi (without soundfont)
- Change tempo without affecting the pitch.
- Jump to other places in the music with a 100% smooth transition.
- Make things happen in your game when certain notes are played in the music.
- For Android there's AndModPlug and BASS
- For iOS there's ChibiXM and BASS
- For Flash there's hxmikmod and Flod
- For Javascript there's WebXmp and others
- For Java there's OZMod
- Generic C/C++ libs: libopenmpt, libxmp, BASS, Milkytracker lib
- For Atari Jaguar there's U-235
- For Nintendo 64 there's an XM player on the way
A MIDI file consists of notation data, describing when to play which note for how long. Unlike the tracker formats described above, it doesn't contain any instrument data, but instead uses instrument data from the playback device.
Advantages
- Nothing gets smaller than this. Absolutely the smallest file-size you'll find!
- Gives you much more control of the music:
- Change tempo without affecting the pitch.
- Make things happen in your game when certain notes are played in the music.
Disadvantages
- It will have a different sound everywhere you play it. And I mean completely different sound. All devices simply have very different sounding instruments.
Platforms
- JavaME
- Android
- iOS
- DOS
midi with soundfont
In order to avoid the problem with MIDI sounding differently on different platforms, you can choose MIDI files that comes bundled with a soundfont. This basically results in a playback very similar to the tracker formats.
Advantages
- Small file-size, like the tracker formats.
- Gives you much more control of the music:
- Change tempo without affecting the pitch.
- Make things happen in your game when certain notes are played in the music.
- Several MIDI files can share the same soundfont. This means that all the music for the whole game could require as little as 1-2 mb!
Disadvantages
- Doesn't have the same options regarding looping and jumping in the music, as the tracker formats offers.
Platforms
- iOS: Read tutorial
- Javascript: MIDI.js and jasmid.
IndieGameMusic recommends
Quality
Filesize
Manipulative
WAV
MP3/OGG
IT/S3M/XM
MOD
GM MIDI
Recommending certain audio file-types will of course always depend on what the top priority for the game-developer is. Whether it's important that file-size is very small, or quality is extremely high. Whether the game-developer needs smooth looping music, and/or lots of control options, such as tempo change and jumping to other places in the music.
Since the main focus of IndieGameMusic.com is game-music, we recommend audio file-types in the following order:
- IT/S3M/XM - because it gives you great sound, low filesize, and lots of control.
- MIDI+soundfont - because it gives you great sound, low filesize, and a decent amount of control.
- OGG - because it gives you great sound, and file-size can be acceptable. OGG let's you do smooth loops of the music. (MP3 does not).
Those are the formats you should aim for, if your platform supports them, and if the track you like is available in any of those formats. See if there's an IT/S3M/XM version of the track available. If not, see if there's a MIDI+soundfont version available, and so on.
If your platform doesn't support playback of any of the above formats, you will of course need one of the other formats. You should note about other formats:
- MP3 - makes it impossible for you to create smooth loops, unless you do some trickery to the file yourself. So if you use the MP3 format, you should find music that doesn't require a smooth loop.
- MOD - are mostly only 8 bit and general low quality compared to IT/S3M/XM. On the bright side, they usually come in a very small file-size though.
- MIDI - will give a different sound depending on device. On the bright side, they come in the absolute smallest file-size.