When importing sounds into your game you may be wondering if you're using the right file format, and if that choice may impact your game. You may not yet know all the differences between formats, and what would be the best option for your needs. Fear not. I'm hoping I'll make everything clear for you by the end of this article.

There are multiple audio formats available to choose from as your game sound files and they can differ both in superficial or more substantial ways.

There are compressed and uncompressed formats. Compressed (lossy) formats can present audible differences in quality even when using similar bitrates and different compression algorithms can generate more or less optimised file sizes. There are also lossless compressed file formats but I won't cover them here as they aren't generally compatible for use in game audio.

The choice of an audio file format is often a balance between quality and file size. We also need to take into account the formats that are supported by our game engine or audio middleware of choice. Let's go over the most commonly supported. I'll start with the uncompressed ones:

Commonly supported audio file formats

Uncompressed audio file formats.

WAV/WAVE (Waveform Audio File Format)

Developed by IBM and Microsoft, the WAV file format is one of the most popular options for uncompressed audio. Although a WAV file can contain compressed audio, it is most commonly used as an uncompressed file format using linear pulse-code modulation (LPCM). This sampling method retains all of the samples of an audio track which guarantees the best possible quality.

AIF/AIFF (Audio Interchange File Format)

AIF files are similar to WAV. The format was developed by Apple and these files are most commonly created using Apple computers. The audio data in most AIFF files is pulse-code modulation (PCM). There is also a compressed variant AIFF-C although it is not commonly used.

When using AIF files we'll most probably be dealing with uncompressed audio. For the purposes of game audio choosing between WAV and AIF will mostly come down to which format is being made available for the project and the compatibility with our selected game engine. There are no discernible audio quality differences and differences in file size are negligible.

Let's now go over the commonly supported compressed (lossy) file formats:

Compressed (lossy) audio file formats.

MP3

MP3 is an audio file format that barely needs an introduction. It is likely that almost everyone has encountered or utilized MP3 files at some point in their lives. MP3 uses lossy data-compression to encode data using inexact approximations and the partial discarding of data. This allows for a large reduction in file size when compared to uncompressed formats.

By using this format we are of course making a compromise by reducing the audio quality. There is, nonetheless, an option to better balance the trade-offs, this is called the bitrate. The bitrate for MP3 (MPEG-1 Audio Layer III) ranges between 32 and 320 kbit/s, the latter provides for the best quality possible and also the biggest files. I should point out that even when using the maximum bitrate the sound quality won't be as good as an uncompressed format such as the ones discussed above.

Vorbis (OGG)

Vorbis is most commonly used in conjunction with the OGG container format and is therefore often referred to as Ogg Vorbis. Vorbis was released in 2000 as an open-source alternative to the MP3 file format. Vorbis is technically superior (addressing many of the limitations inherent to the MP3 design). Vorbis is also generally considered to have better sound quality than MP3, especially at lower bitrates. Files are also typically smaller at the same bitrate.

Opus (OGG)

Opus is a newer codec using the OGG container format. Since 2013 that the Xiph.Org Foundation (the developers behind Vorbis) state that the use of Vorbis should be deprecated in favor of the Opus codec. Several blind listening tests have ranked it higher-quality than any other standard lossy audio format at any given bitrate, including MP3 and Vorbis.

FastTracker II music tracker software.

Tracker files (MOD, IT, S3M, XM)

Other file formats to be aware of are tracker files. Tracker files are created using music tracking software. They combine both note data and short high quality PCM audio samples which allows for the reproduction of full musical compositions while keeping the file size small. Tracker files are great because even though their size is small there isn't a corresponding loss of sound quality.

The most popular formats for tracker files include MOD (Amiga), XM (FastTracker II), IT (Impulse Tracker), and S3M (Scream Tracker 3). Due to their small size, they were popular for use in early computer games and demos, where limited storage space was a concern. This format remains popular among some electronic and chiptune artists today and modern game engines may still have support for these types of files. Unity is such an example.

Which audio file format should I choose?

There are more appropriate options than others when it comes to choosing an audio file format but there isn't a clear cut answer as to which one we should choose for our project. The reality is that it will probably be best if we use more than one. The question then becomes when to use which. We'll cover that in just a moment.

Ideally we would always opt for the highest audio quality for every single sound effect or piece of music in our project, but that may not always be practical as some projects may contain hundreds or even thousands of audio files. If every audio file is uncompressed, it will quickly add up, and the game will reach a large bundle size. For reference, uncompressed file formats have a size of about 10 MB for one minute of stereo audio at 44.1 kHz/16 bit (CD quality). 

We don't need to commit to just a single audio file format for the whole project. We can make conscious decisions and choose between them depending on the situation. We have of course to make these decisions based on the final bundle size that would be optimal for our target platform(s) as well.

In the case of mobile games for example, we will probably want to keep the bundle size as small as possible. A smaller bundle size will help ensure that the game downloads quickly even on slower internet connections. Additionally, a smaller bundle size will reduce the amount of storage space required to install the game, which will make it more probable that users will be able to install it even when running low on free space.

We don't need to commit to just a single audio file format for the whole project. We can make conscious decisions and choose between them depending on the situation.

Let's now go over which file formats are best in their respective uncompressed and lossy categories:

As uncompressed file formats you can choose between WAV and AIF as they're very similar. The choice will mainly depend on which of these are available for your project and the compatibility with your game engine. Tracker files can also be considered as uncompressed since the samples inside use PCM. For tracker files you can choose any of the common formats (MOD / IT / S3M / XM).

As lossy file formats I recommend the use of OGG, whatever the codec being used inside (Vorbis/Opus). It is generally well supported by game engines and audio middleware and as seen before, it presents advantages in both quality and file size over MP3.

Also, MP3 should not be used for looping sounds (such as gameplay music). This is because when looping an MP3 file there can be a brief silence or gap at the end before it starts over again, which can be noticeable and disruptive to the player. OGG files can also present lower latency compared to MP3, making them a better choice for games that require real-time audio processing. 

In summary, for uncompressed full quality audio use WAV or AIF. Tracker files are also a great option If music is available for the project in this format. As a compressed file format use OGG.

When to use which?

As you'll see the choice of an audio file format for each use case isn't that difficult. WAV and AIF are great options for short sounds in which we don't want to loose any definition, specially if they sound very clean and noiseless. An example would be UI (user interface) sound effects, as audio design for UIs is frequently clean.

Compressed file formats are best for longer sounds like background music, dialog and long sound effects. They also work great for sound effects with some degree of noise present such as footsteps, impacts and weapons.

The reasoning behind this is that for clear sounds you'll probably want the best possible audio quality. By using an uncompressed file format you'll avoid the introduction of digital distortion and artefacts that can result from compression. Also, since the sounds are short, the bigger file size won't be much of a penalty.

On the other hand, compressed formats are better for longer sounds because file size differences wouldn't be so small for this use case. Also, noisy sound effects will probably mask most compression artefacts and as such the loss in quality will most probably go unnoticeable.

WAV and AIF are great options for short sounds. Compressed file formats are best for longer sounds.

In the case of tracker files for music, if they're available and they are the best option for your project (generally retro style games) you can use them freely without any penalties. They generally have a very small size and deliver full quality audio

Keep in mind that this is just a general guideline, you may need to make more, less, or no compromises at all regarding the audio quality depending on the number of audio assets in the project and the target build size of the game. Also, keep in mind that compressed file formats can be created at higher and lower bitrates, which impact both their quality and size.

Additional notes

The Unity Inspector with audio transcoding options highlighted in red.

Some game engines such as Unity have the ability to transcode audio files. In this case we could just opt to import uncompressed WAV/AIF files (if they're available in these formats) and allow the engine to do the audio compression work. This can be easier and more flexible than importing different file formats for each use case, as we can apply compression, adjust the quality level and revert without ever needing to reimport.

Conclusion

Carefully choosing the right audio formats is an important decision that can significantly impact your game project both in sound quality and final bundle size. Today there are a vast array of audio file formats available but as seen in this article, we can mostly narrow down the options to just two: An uncompressed and a compressed format. Then it's just a matter of using them where appropriate.

Have any questions or want to share your thoughts about this subject? Leave a comment below!

Jack Type
Blips founder, video game music composer & technical sound designer

As a child I never missed an opportunity to tear a toy with some electronics apart and use the parts to create something new. I ended up taking an electronics/programming course in my teens while also developing a deep passion for music. Owing much of this passion to a family owned night club and venturing briefly as a DJ, I embarked on a music production journey, and being an avid gamer triggered the desire to be involved in the creation of a game's music and sound. While continuing to grow both my technical and creative skillsets, I found that video game development fits me like a glove. It allows me to fully apply those skills for an endless number of possibilities.

Blips Game Music Packs

Note: You're leaving the Blips Blog. The visited links may be subject to different privacy and cookie policies.