Making Your Unity Game Scream and Shout and Not Killing It in the Process

Arthur Mostovoy
May 17, 2016 · 4 min read

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

  • RAM usage: nominal (x1)
  • Audio quality: high (source)
  • File size: high (source)
  • Usage scenario: short high-quality sounds (UI clicks and sounds and such)

ADPCM

  • RAM usage: medium(x3.5)
  • Audio quality: medium
  • File size: medium
  • Usage scenario: short noisy sounds (bullet hits, explosions, steps, weapon shots etc.), rarely — medium sounds

Vorbis

  • RAM usage: high (x10)
  • Audio quality: potentially low (depends on compression power)
  • File size: potentially low (depends on compression power)
  • Usage scenario: 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

  • Disk i/o: nominal
  • Usage scenario: 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

  • Disk i/o: nominal
  • Usage scenario: 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

  • Disk i/o: medium
  • Usage scenario: 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

Force to mono

Normalize

Load in background

Preload audio data

Conclusion


If you liked this story, you may find some of my other stories relevant:

My thoughts on virtual reality

VR development: tips and tricks

Content design in a nutshell

Thanks to Nikita Guk.

Arthur Mostovoy

Written by

Video game producer, zealous gamer, occasional writer. Connect with me @ fb.com/arthur.mstv or linkedin.com/in/arthurmstv.