Saturday, May 30, 2015

How we reduced the size of our iOS app Monster Math from ~108MB to ~39MB - Part 3

This is the third and final post in the series of posts where, I will explain, How we reduced the size of our iOS app Monster Math from around 108MB to 39 MB.

In the previous post, I explained how we first converted our 24bit PNG images to 8bit PNG and then converted those 8bit PNG images to WebP images.

If you didn't get a chance to catchup on this series yet then, I suggest first read Part 1 and then Part 2 and then continue reading this last post.

Convert All Sounds and Music files from WAV (or any other format to) AAC Format

I said this in the first post and I will say it again, "WAV files are huge, don't use them period!".

We converted all the WAV files into AAC format.  This gives us enormous savings of around 70-80% per file!

To convert WAV files to AAC, we will use the Audio File Converter (afconvert) tool which comes pre-installed with MAC.  A small shell script to convert all WAV files to AAC would look like this
This simple shell script will find all the WAV files in a given directory and passes them to afconvert which converts them into AAC format.  

The results are awesome, you got to see it to believe it!

Reducing bit rate of AAC Voices to 32K

We had like a ton of voices in our app in AAC format.  Reducing the bit rate of all these AAC voices to 32K give us another 70-80% reduction in the file size!

To reduce the bit rate we will use the same afconvert command with a slight modification.  This command has an option via which we can specify the bitrate to be used.
Only real difference between the previous and this script is the option "-b 32000".  This will make sure that all the converted files will have 32000 as the bit rate!

These were the last two important methods that gave us significant size reductions in the final binary.

Thats all folks, have fun reducing the size of your binaries!
Have some Fun!