Sunday, February 1, 2009

Compressing audio

During the initial development of Abby Crabby our binary (application size) swelled to about 10MB. We became concerned knowing that applications over 10MB cannot be purchased over cellular connections and yet we still had a good deal more sound and graphics to put into the game. Impulse buys are lost if buyers are forced to desktop iTunes to make their purchases.

I met the CEO of PlayScreen on LinkedIn a while back. We've had some great conversations about the iPhone market. He passed me some promotional codes for his applications and I looked them over. Pigs A Popn is my favorite of the bunch, but recently Bounce Trap Tilt has been getting some attention as an iTunes featured application.

The secret for being featured? According to William it was just a matter of updating the application to meet user requests. You can read more about it on his blog. One of the things mentioned there is "a new audio driver and shrunk the game from 26MB to 9.3MB". He had also taken my advice on audio compression!

The Apple's OpenAL example sources use uncompressed CAF files (little endian AIFF files) only. We were using these sources. Our size budget was nearly blown after we added our in-game and menu sound tracks. The way around these issues is to switch to a compressed audio IMA4 format. Existing CAF files can be converted with usr/bin/afconvert at the command line on a development machine. From there the OpenAL wrappers in the application must be modified to read and uncompress the audio at application launch. The IMA4 to CAF conversion achieves a compression of about 4:1. The Abby Crabby binary dropped from 10MB to 2.5MB without any perceivable difference in operation to the user. This provided plenty of headroom for more sounds and graphics while still remaining under the 10MB mobile download limit.

Labels: , , , ,

0 Comments:

Post a Comment

<< Home