PerrBear
PerrBear

Reputation: 1

IOS Audio Compression

I am creating a game that uses a lot of small (5K-40K)sound bites (15M of mp3) to make voice responses. Apple's best practices talk about compressed formats. If I use "afconvert -f AIFC -d ima4 sound.wav" to compress any of the files, I get one almost four times the size. Should I just use mp3s? Is there another way of compressing files, or am I doing something wrong? Being a newbie to programming, I would appreciate any advice on how to keep my app bundle smaller.

Upvotes: 0

Views: 2731

Answers (2)

user4023800
user4023800

Reputation:

Please note the difference between the following concepts:

  • Audio compression effects, which are applied during audio recording & production, reduce the dynamic range of the audible sound.
  • Fize size compression, like ZIP, reorganizes redundant information to make a file more “efficient” and thus lowering the storage needed.
  • Audio codec compression, which entails manipulating the actual audio data to remove informtion, resulting in a lower file size.

Answer:

WAV is actually an uncompressed audio codec. MP3 is a compressed format.

In your example, you are converting “backwards” to a larger file size. Your files are already MP3; so they should require no further codec compression.


Additionally: MP3 is a “lossy” compression format, so you can not recover information removed in compression. For this reason, you should basically never convert from MP3 to WAV (audio quality begins to suffer quickly when doing that). Ensure that all audio processing is finished using an uncompressed format first, then convert to a lossy format as the very last step.

Upvotes: 2

Avt
Avt

Reputation: 17043

First off all check that audio bitrate is not too big. Typical bitrates for different purposes:

  • 32kbit/s: AM Radio quality
  • 48kbit/s: Common rate for long speech podcasts
  • 64kbit/s: Common rate for normal-length speech podcasts
  • 96kbit/s: FM Radio quality
  • 128kbit/s: Most common bit rate for MP3 music
  • 160kbit/s: Musicians or sensitive listeners prefer this to 128kbit/s
  • 192kbit/s: Digital radio broadcasting quality
  • 320kbit/s: Virtually indistinguishable from CDs
  • 500kbit/s-1,411kbit/s: Lossless audio encoding such as linear PCM

So for speech 48 kbit/s is usually enough.

Second - you should use better compression codec than AIFC. For detail information please check this link http://soundexpert.org/encoders-48-kbps but AAC codec is always the best.

Other codec options (sample rate, bit depth, etc.) are not so important and usually you should leave them default.

Upvotes: 0

Related Questions