Just as overtuned graphics can turn a fluid gameplay into a 5 FPS slideshow, poorly configured audio assets can wreak havoc on your target devices. To avoid unnecessarily high CPU load and unwise RAM/storage usage (and crashes, too) all you need to do is choose the right audio import settings in Unity 5.

I have been recently faced with a challenge of optimizing audio assets in the project I’m working on and after reading a dozen articles on Unity 5 audio optimization and talking to professional sound designers, I’ve turned theory into practice and decided to compile and put together all the knowledge I’ve gathered over this time.

I am listing all the audio import settings offered by Unity 5 and their recommended values below. I’ve made an attempt to approximately estimate CPU load and/or RAM or disk usage for each setting along with the output quality.

Before we start, an important note — your source files should be .wav of highest quality possible.

Compression

PCM

CPU usage : low

: low RAM usage: nominal (x1)

nominal (x1) Audio quality : high (source)

: high (source) File size : high (source)

: high (source) Usage scenario: short high-quality sounds (UI clicks and sounds and such)

ADPCM

CPU usage : medium

: medium RAM usage: medium(x3.5)

medium(x3.5) Audio quality : medium

: medium File size : medium

: medium Usage scenario: short noisy sounds (bullet hits, explosions, steps, weapon shots etc.), rarely — medium sounds

Vorbis

CPU usage : high

: high RAM usage: high (x10)

high (x10) Audio quality : potentially low (depends on compression power)

: potentially low (depends on compression power) File size : potentially low (depends on compression power)

: potentially low (depends on compression power) Usage scenario : medium and long sounds and music

: medium and long sounds and music Note: When choosing Vorbis as compression type there’s a slider that lets you adjust the compression power — you can set it to any discrete integer value between 1 and 100 where the lower number corresponds to higher compression power. Your aim is to compress the sound as much as you can while keeping the audio quality reasonably high i.e. find a sweet spot. Usually it’s around 70, but the value may vary depending on the source audio quality.

Load Type

Decompress on load

RAM usage : potentially high (decompression of all assets at the same time)

: potentially high (decompression of all assets at the same time) Disk i/o : nominal

: nominal Usage scenario : frequently played short PCM or ADPCM sounds

: frequently played short PCM or ADPCM sounds Note: The sound is decompressed as soon as it’s loaded. Used for smaller compressed sounds to avoid the performance overhead of decompressing on the fly. This option barely requires any CPU to play the audio, however it requires the most RAM for simultaneous decompression.

Compressed in memory

RAM usage : medium

: medium Disk i/o : nominal

: nominal Usage scenario : rarely / frequently played medium ADPCM or Vorbis sounds (i.e. stingers — victory melodies and such) or rarely played short ADPCM sounds

: rarely / frequently played medium ADPCM or Vorbis sounds (i.e. stingers — victory melodies and such) or rarely played short ADPCM sounds Note: The sound is stored in RAM and is decompressed on the fly when prompted. Does not use any additional RAM when decompressing.

Streaming

RAM usage : low

: low Disk i/o : medium

: medium Usage scenario : music and ambient tracks

: music and ambient tracks Note: The sound is stored on disk and played when prompted. Minimal RAM used. Do not use more than 1–2 tracks with of this load type in the same scene.

Other Settings

Sample rate

It’s generally advised to override the default sample rate and set it to 44.1 kHz because that’s what soundcards on most devices usually support for certain.

Force to mono

Forces your audio to mono format. Optimally this should be enabled for all audio assets except music. However, forcing an asset to mono saves more space the longer the track, so in case you want to save as much space as possible you can force your music to mono, too. This is generally not desirable, though.

Normalize

Becomes available when Force to mono is checked. Normalizes the volume that could be altered by forcing the sound to mono. Should be ticked along with Force to mono.

Load in background

Disabled by default and should remain this way unless there’s an exception. If enabled, the audio clip will be loading in the background without causing stalls on the main thread. By default all the sounds have finished loading when the scene starts playing.

Preload audio data

Enabled by default and should remain this way unless there’s an exception. The audio clip will be pre-loaded when the scene is loaded, as by default behavior.

Conclusion

That’s pretty much it — not so hard, right? Stick to the guidelines, use common sense and you’re good to go — implementing sounds and music into your game should be a breeze.