★ TouchArcade needs your help. Click here to support us on Patreon.

Best way to compress music?

05-08-2010, 07:59 AM
#1
Joined: Oct 2009
Posts: 249
Best way to compress music?

Hi,

I need to borrow your wisdom fellow developers.

I want to include 8 awesome music tracks in my next update to spice up user experience a little.

My question is what is the best way of compressing/converting mp3 music for iPhones?

Each track currently is of high bitrate and is ~8mb, which unacceptable.

Need to find a good balance between size/quality.

Thank you.

Start your engines gentlemen, Vector Rally is out!

---
Twitter: http://twitter.com/VectorRally
05-08-2010, 10:16 AM
#2
Joined: Jan 2009
Location: Toronto, Ontario, Canada
Posts: 5,206
Use AFConvert. It's built-into the MacOS and converts audio to lossless CAF format (compressed AIFF). Open a command line and use the following:

afconvert -f caff -d ima4 [source] [dest]

Where [source] is the WAV (or whatever format it is) and [dest] is the .caf file you want to make out of it. This should cut the size down by at least half and leave you with 100% quality. The iPhone natively understands CAF format, so you should have no problems.

NOTE: When I say "cut down the size by half" I mean by half of the uncompressed file size, so if it's a 5-minute WAV file (~50mb) you can get it down to 25mb or less.

[Relax with Galactic Chill] [Let me tell you a story.]
Currently working on: Music for Spirit Hunter Mineko

05-08-2010, 11:03 AM
#3
Convert to AAC (which sounds better at low bitrates), trying increasing levels of compression until it starts sounding noticeably bad, then back off to the previous level. Different types of music will reach the point of sounding bad earlier than others, so there's not one definitive level of compression. Always start with uncompressed, so you don't add lossy compression on top of lossy compression. There's a lot of apps that will do this, but you can always just use Garage Band.

--Eric

Realmaze3D on the App Store
Realmaze3Free: 3 free mazes (a taste of Realmaze3D)
05-08-2010, 06:29 PM
#4
Joined: Aug 2009
Posts: 26
Quote:
Originally Posted by Mindfield View Post
Use AFConvert. It's built-into the MacOS and converts audio to lossless CAF format (compressed AIFF). Open a command line and use the following:

afconvert -f caff -d ima4 [source] [dest]

Where [source] is the WAV (or whatever format it is) and [dest] is the .caf file you want to make out of it. This should cut the size down by at least half and leave you with 100% quality. The iPhone natively understands CAF format, so you should have no problems.
A bit more information about CAF, CAF is just a container for many audio formats. If it's lossless or not depends on the audio format inside. The example you give will convert into IMA4, a compressed format with a compression rate of roughly 4:1. So the quality won't be 100 % compared to the WAV. The quality can still be acceptable though.

To make your music smaller you could also try to lower the sample rate or switch from stereo to mono. Just try it and listen if it's still acceptable.

You're speaking in terms of bitrate, which suggests you're talking about an mp3. If that is the case I would suggest getting the original material in an uncompressed format (WAV) and then try the suggestions posted here.

Lunarcy a really challenging retro looking arcade game.
05-08-2010, 09:03 PM
#5
Joined: Sep 2008
Location: Los Angeles, USA
Posts: 722
Another thing we usually do is to change all the SFX into mono, since they arn't as important as the music in terms of quality. Saves quite a bit of memory since the SFX are all lossless WAV's .
05-08-2010, 10:31 PM
#6
Joined: Jan 2009
Location: Toronto, Ontario, Canada
Posts: 5,206
Quote:
Originally Posted by xother View Post
A bit more information about CAF, CAF is just a container for many audio formats. If it's lossless or not depends on the audio format inside. The example you give will convert into IMA4, a compressed format with a compression rate of roughly 4:1. So the quality won't be 100 % compared to the WAV. The quality can still be acceptable though.

To make your music smaller you could also try to lower the sample rate or switch from stereo to mono. Just try it and listen if it's still acceptable.

You're speaking in terms of bitrate, which suggests you're talking about an mp3. If that is the case I would suggest getting the original material in an uncompressed format (WAV) and then try the suggestions posted here.
It isn't lossless? I'd assumed it was simply because it still resulted in a file that was considerably larger than an ordinary 128kb/s MP3. (It was closer to the size of a 320kb/s or higher MP3) Whatever the case, I used this to convert the songs I did for Theme Park Madness, and before I submitted them I did some tests to compare the audio quality between the original WAVs and the CAFs and couldn't tell the difference at all -- and since I was going for top quality I was listening pretty closely.

[Relax with Galactic Chill] [Let me tell you a story.]
Currently working on: Music for Spirit Hunter Mineko
05-08-2010, 10:42 PM
#7
Joined: Oct 2009
Posts: 249
Thank you guys, lots of good info!

These are available formats to download:

Track length: 2:52

mp3 320k - 6.7mb
FLAC - 18.6mb
mp3 VBR High - 6MB
mp3 VBR Low - 4.4MB
AAC High - 4.1MB
AAC Low - 1.8 MB
Ogg Vorbis - 3.9mb
ALAC - 19.1mb

As there is now Wav, which one of this list you reckon is best to work with?

I want to squeeze each 2 min track into 400-600kb or even less if possible.

Start your engines gentlemen, Vector Rally is out!

---
Twitter: http://twitter.com/VectorRally
05-09-2010, 08:41 AM
#8
Joined: Sep 2009
Location: UK / Toronto
Posts: 602
Use FLAC or ALAC — "Free Lossless Audio Codec" and "Apple Lossless Audio Codec" respectively. If you're doing this on OS X you're probably better off selecting ALAC.

But I'm sorry to say, it will be very difficult to get down to 400kb from a 2:52 track.

But your best solution is to use these settings (iTunes is the best AAC encoder):

- 48kbps
- mono
- 41.000Khz
- VBR
- High Efficiency

That will get you to around 700kbps for a 3 min track and still have bearable sound quality. You could take a jump at 32kbps but I wouldn't recommend it, but you can always try it and see how it sounds.

If you still need less space… well, there's always midi…
05-09-2010, 05:15 PM
#9
Joined: Oct 2009
Posts: 249
thanks mate, will try this and see how it goes..

Quote:
Originally Posted by EssentialParadox View Post
Use FLAC or ALAC — "Free Lossless Audio Codec" and "Apple Lossless Audio Codec" respectively. If you're doing this on OS X you're probably better off selecting ALAC.

But I'm sorry to say, it will be very difficult to get down to 400kb from a 2:52 track.

But your best solution is to use these settings (iTunes is the best AAC encoder):

- 48kbps
- mono
- 41.000Khz
- VBR
- High Efficiency

That will get you to around 700kbps for a 3 min track and still have bearable sound quality. You could take a jump at 32kbps but I wouldn't recommend it, but you can always try it and see how it sounds.

If you still need less space… well, there's always midi…

Start your engines gentlemen, Vector Rally is out!

---
Twitter: http://twitter.com/VectorRally
05-09-2010, 06:31 PM
#10
Joined: Aug 2009
Posts: 26
Quote:
Originally Posted by Mindfield View Post
It isn't lossless? I'd assumed it was simply because it still resulted in a file that was considerably larger than an ordinary 128kb/s MP3. (It was closer to the size of a 320kb/s or higher MP3) Whatever the case, I used this to convert the songs I did for Theme Park Madness, and before I submitted them I did some tests to compare the audio quality between the original WAVs and the CAFs and couldn't tell the difference at all -- and since I was going for top quality I was listening pretty closely.
Well it isn't lossless, meaning if you would convert it back to the source format it wouldn't be exactly the same bitwise. When listening to it, you'd probably wouldn't notice the difference indeed. The size is a bit bigger than a 320 kbit/s mp3, which has a compression rate of roughly 4.4:1.

@eJay, for such strict space requirements AAC is probably best. Instead of 44.100 kHz, you could also try 22.050 kHz.

Lunarcy a really challenging retro looking arcade game.