0
\$\begingroup\$

I create a mobile app in Unity that use lots of MP3 files.

Would you please tell me if there are any simple and easy softwares or tools that can reduce the MP3 file size ?

Or does Unity have a way to reduce the MP3 file size ?

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Sounds like a question for softwarerecs.stackexchange.com \$\endgroup\$
    – Mangata
    Commented Dec 26, 2022 at 2:58
  • \$\begingroup\$ @Mangata, I will go to that website. Thanks for the pointer. \$\endgroup\$ Commented Dec 26, 2022 at 3:06
  • 1
    \$\begingroup\$ MP3s are already well compressed. They probably can be further compressed but for most of them it won't be by much. \$\endgroup\$
    – Nikaas
    Commented Dec 26, 2022 at 9:41
  • 1
    \$\begingroup\$ @Mangata We got an xy-problem here. Using an external program to re-encode the MP3 files in a different format before importing them into Unity isn't a good way to solve this problem. See my answer for details. \$\endgroup\$
    – Philipp
    Commented Dec 26, 2022 at 13:10

1 Answer 1

4
\$\begingroup\$

According to the documentation, Unity will re-encode any audio file you import into it anyway, so the compression of the source files isn't that relevant. And every time you re-encode an audio file in a different format (or the same format with different quality settings) you lose quality while not necessarily also reducing filesize. The default encoding format when you import a clip into Unity is "PCM" which doesn't compress at all. So by pre-compressing the audio files and then letting Unity convert them into PCM, you achieve nothing except making it sound worse.

So the recommended workflow for working with long audio files is:

  1. Get a copy of the audio clip in the highest quality and as few encoding steps away from the master recording you can get.
  2. Import it into Unity.
  3. Go to the import settings of the audio clip asset.
  4. Under "Compression Format" pick "Vorbis" or "MP3" (which one you can choose depends on your build target)
  5. Adjust the "Quality" slider to get a good compromise between file size and quality.
  6. When the input clip is in stereo, then depending on how the clip is used in your game, you might also consider to enable "force to mono" which usually cuts the filesize down to less than half of the original. Mono is usually what you want anyway for sounds which are supposed to be played positionally. It also usually works well for voiceovers as long as you don't have more than one person speaking in the same clip (when you have a conversation between multiple characters, then it's best to record their individual lines as mono clips and use positional audio to make the voice of each character come from a different direction). But I would not recommend it for non-diegetic background music that was produced in stereo, because that will probably make the experience worse and go against the artistic vision of the one who produced it.

The inspector will tell you the filesize taken by the audio clip in the finished game and you can click the "play" button on top of the histogram image below to preview the file. Note that the preview only updates when you click on "Apply".

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Also note that this workflow only applies to long audio files like voiceovers, background music or ambience tracks. Short sound effects, where filesize isn't too much of a concern, are best kept in PCM to improve performance and quality. \$\endgroup\$
    – Philipp
    Commented Dec 26, 2022 at 14:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .