Unity Audio Overview Edit

Internally, Unity's default audio system is built on top of the FMOD Low Level API. This does not support FMOD Studio but that integration is offered separately (see below).

The first stop for learning about Unity audio is to read up on audio in the official documentation. Unity's Audio system is fairly comprehensive and extremely flexible. It is worth it to at least skim the sections in the documentation to at least get an idea of the scope of the available systems.

The WebGL Exception Edit

According to Unity's documentation:

Audio in WebGL is done differently then on all other platforms. On other platforms we use FMOD internally to supply audio playback and mixing. Since the WebGL platform does not support threads, we need to use a different implementation, which is internally based on the Web Audio API, which lets the browser handle audio playback and mixing for us.
Unfortunately, this limits audio functionality in Unity WebGL to supporting only the most basic features.
The specific features are outlined in the official manual page.

Unity Audio Demos and Native Plugins Edit

Unity 5 brought several major enhancements to Unity's Audio system, including the AudioMixer and Native Audio Plugins. Less-well known is that they have open-sourced several demos and native plugins that you're welcome to use for free. These can be obtained here:

Things the Manual Doesn't Tell You Edit

What follows is some information tidbits that were gleaned from various sources and don't appear in any official documentation. If you find that these morsels do appear in documentation, please update the page with the clarifications!

Unity 5+ Recompression Edit

Since Unity 5, Unity recompresses all audio data. See:

We don't support ogg audio in the unity audio formats, we support a completely separate implementation of vorbis with a custom container type. No Ogg.

This is chosen for:

  1. Ogg includes an unnecessary amount of bloat that we don't require.
  2. Our Ogg-less decoder is much faster than the default ogg-vorbis codec, and uses less memory.

So no, there is no way to avoid re-compression. ... You should not be importing already compressed audio into Unity. Instead you should import the uncompressed source WAV files into Unity and decide your compression scheme in Unity. ... When importing audio, you can chose to preserve the sample rate of the original file, select a different rate, or let us optimise the rate intelligently.

The quality slider of the compression is mapped to the standard quality scale of vorbis [-1, 10].

Moral of the story is don't import already compressed audio into Unity, thats wrong.

It is important to note that the above quote is specifically referring to post-build audio formats. Ogg audio is supported in the Unity Editor. The quote simply explains that during a build Unity will recompress audio data using a custom format.

Source: the Unity Beta list.[1]

Unity Audio Middleware Edit

There are several audio middleware tools available for Unity, ranging from useful interface enhancements to entire audio sub-system replacements. Some of these include:

References Edit

  1. Unity Beta List topic "compressed .ogg audio is recompressed on import, even at quality 100", message from 11/30/2015
Community content is available under CC-BY-SA unless otherwise noted.