Avoiding audio transcoding in Unity?

I’m working on a project where I only have access to MP3s versions of audio tracks I’d like to use. Unity is trying to be helpful and recompressing everything as Vorbis, which is not ideal due to quality loss. Even if I override the audio clip settings and set it to use MP3, Unity still transcodes the file for me, resulting in quality loss. I can set the clip to PCM, which would avoid re-encoding the file into another lossy format, but the resulting file size is too large to be practical.

In a perfect world I would have WAV versions of all the tracks I want to use, but that is not the case. Is there anyway to tell Unity to use the file the way it is and to leave it alone and not recompress it?

For the record I am using Unity 5.3.1 and my project target is iOS.

Surprisingly, there’s simply no way to do this, it’s just how Unity is.

It’s a case of, every single audio engineer who works on a Unity project for the first time, is shocked to learn this!

The internal paradigm of Unity per their AudioClip import concept is that upon import it completely expands the sound first, and then compresses it according to a couple of choices you have (depending on the version of Unity), and a slider. It’s then saved internally … to be used for the actual shipped product.

To “adjust the compression” of audio clips in Unity, it literally just comes down to the programmer setting a slider - that is literally and absolutely the only choice you have!

So, after building the project the producers or whoever will say “ok, the final build could be a bit bigger so let’s increase the sound quality” or “we’ll have to compress the sound a bit to make the build a bit smaller” - and it’s literally just a case of moving that slider.

Again regarding the audio files you “drop in” to Unity, there is absolutely literally no point doing anything to them - just drop in the full-size totally uncompressed versions.

(Careful audio engineers sometimes care for even the frames of the audio files, so that frames end clean and stuff - this is absolutely pointless when sending to a Unity project as Unity just unpacks them and recompresses/packs as it sees fit!)

Note that Unity tend to noodle with the formats it uses (“compresses to” if you will) each new version, you can usually see the details here or on their change logs Unity - Manual: Audio Clip Again as the audio engineer all you can really do is tell the programmers “please choose XYZ compression” (from the list there) and “set the slider to 48%” - !


BTW note this point … you simply cannot loop mp3s in Unity, if you have to loop, instead just send over wav or whatever.

To be absolutely clear,

Is there anyway to tell Unity to use the file the way it is and to leave it alone and not recompress it?

(i) there is NOT any such button in Unity (ii) it’s not conceptually possible based on how Unity works: every audio file is taken apart by Unity and “handled” by the Unity pipeline entirely; it does not, at all, “use what you give it”. In contrast with say PNG assets it actually “uses the binary data you give it”; this is just not the case with audio assets (much to the surprise of audio engineers everywhere!)