« A Prayer To A Supreme Being | Main | Great Googly Moogly! »

Lossless Is Good

If you keep up with Apple developments at all you probably already know that today is the one year anniversary of the iTunes Music Store. In honor of that Apple released iTunes 4.5 and Quicktime 6.5.1.

The new version of iTunes includes features like the Party Shuffle, Jewel Case Insert Printing, and iMix. You can read about all that stuff over at Apple's site or pretty much any other Mac news website.

The feature that I found most intriguing is the new Apple Lossless Audio Codec that comes with Quicktime. MP3s and AACs have revolutionized how we think about music. But let's face it, they are compressed audio files. Any CD will sound better. iTunes and the iPod will quite happily play uncompressed AIFF files but they are much larger. You are probably familiar with an MP3 at 128 kbps. An uncompressed AIFF file runs at 1411 kbps. In other words, 0.94 MB per minute versus 10.33 MB per minute.

So I pulled out my CD of Jet's "Get Born" and decided to do a little experimenting with "Are You Gonna Be My Girl." Marc Heijligers did some excellent qualitative studies of various types of audio compression in "Encoding Observations." I used a method similar to his to analyze Apple's Lossless compression.

I used Peak to rip an uncompressed AIFF of the track. I opened that file with Quicktime Player Pro and exported it to a movie with the Lossless codec. (Unless I missed something, it seems that only the "export to Quicktime Movie" option allows you to use that codec.)

Export to Quicktime Movie with Apple Lossless Compressor

Just to be completely legit, I exported another movie with the audio uncompressed. The first thing I noticed was the difference in file size. At 3:33 long, "Are You Gonna Be My Girl" was 36.1 MB uncompressed and 27.1 MB with the lossless compression. The compressed file was 25% smaller. Again in comparison, a 128 kbps MP3 is 91% smaller. For this song it would be about 3.3 MB

Obviously an MP3 or AAC is a lot smaller, but you also lose some of the sound information in the process. This new Apple Lossless codec promises to save 25% in file size and is supposed to sound exactly the same. To test this out I opened both the uncompressed movie and the lossless movie in Peak.

Visually the two files seemed to have identical waveforms.

Uncompressed Audio
Uncompressed Audio

Lossless Compressed Audio
Lossless Compressed Audio

With a quick listen on my studio headphones, I couldn't tell the difference. I needed to be sure though that there was literally no difference. This is where I used a method that Marc talked about in his article.

I inverted the phase of the Lossless compression file.

Invert Phase

Then I copied the entire file to the clipboard, and using Peak's "Add" DSP function, I mixed the phase inverted Lossless audio with the original uncompressed audio.

Add Function

The resulting audio file was completely silent.

Silent Audio

A sound waveform looks a squiggly line drawn along the X-axis of an X/Y graph. You might be familiar with a Sine wave from trigonometry. A simple tone looks like that. When a sound is phase inverted, the peaks and valleys of that squiggle are swapped. So where the original sound might have a peak at 4 on the Y-axis, the inverted sound would have a valley at the same point in time at -4 on the Y-axis. Obviously if you add 4 and -4 you get zero. So a phase inverted sound mixed into the original sound should give you a silent audio file.

Since I phase inverted the compressed file, mixed it in with the uncompressed file, and wound up with a silent file, the codec truly is lossless. The two files are sonically identical.

Out of curiosity, I imported the original AIFF file into iTunes. I went into the preferences and changed my import settings to "Apple Lossless Encoder."

iTunes Importing

Then I used the "Convert" function under the Advanced menu to convert my AIFF into a compressed file using the new Lossless codec.

Convert Selection

The resulting file was an AAC file with the same .m4a extension as my other AACs. When I got info on the new AAC, I found that it was 1061 kbps.

Info for Uncompressed Audio
Uncompressed Audio

Info for Lossless Compressed Audio
Lossless Compressed Audio

With a space savings of 25% and truly no loss of sound quality, Apple's new codec is definitely something to take a look at for both sound professionals and audiophile consumers.

TrackBack

Listed below are links to weblogs that reference Lossless Is Good:

» Great Googly Moogly! from Monsters from the Id 怪獣大悪脳
... or How To Blow Your Website Statistics Right Out Of The Water. I'm a sound guy. They pay me to put funny noises in movies. I like to play with computers. I watch Star Trek, and I love fantasy... [Read More]

» I Just Wanna Go To The Rock 'n' Roll Show from Monsters from the Id 怪獣大悪脳
Both Wednesday and Thursday night I saw Sleater-Kinney play El Rey here in Los Angeles. (I've mentioned this already.) They are such a great band. There had been some talk on the wordsandguitar mailing list that someone had recorded the... [Read More]

Comments

Hey, what's up, I am a pro audio guy, MOTU DP, Mackie HR 824, MOTU 828

All my CD's are ripped thru iTunes 4 AAC 256 kps, they sound pretty good, I have some pretty good, CD's , high quality Jazz Fusion, Funk, etc. GRP Chick Corea Electrik Band, took this CD and ripped directly in iTunes 4.5 lossless, I got a 609 MB CD, and iTunes Lossless got it to 361 MB, so this is a little less than half savings. pretty good.

cool trick with peak with phase invert, i'll keep that in mind.

john k

nice piece! One question, do you have any idea what codec Apple lossless is based on, FLAC? Something else?

thanks

I encoded a couple files last night. 1:AIFF=32.1, FLAC=19.1, M4A=18.6 2:AIFF=249.8, FLAC=129.6, M4A=128
I don't know what that tells you. Maybe very similar to flac but minus some type of file information or something. So far, it seems to be a little better in compression ratio. I am no expert on it but I know flac can do 24-bit files and I believe it can do 48kHz stuff. I don't know about m4a. Does anyone?

-Jeff

Hey guys. Thanks for taking the time to drop me a note.

John - I've never used Digital Performer or the 828. We're all Pro Tools in the office. Those Mackie speakers sound pretty nice for the price though.

Hadley - I don't know if they used FLAC. My old college roommate is on the Xcode team at Apple. I'll drop him a line. He'll know who to ask.

Jeff - I found this on the same MacSurfer page that lead you all to me:

http://docs.info.apple.com/article2.html?artnum=93769

QuickTime Player will play back 24 bit audio. But when something is exported, it is always down-converted to 16 bit first. So FLAC sounds like a better way to go. iTunes and Quicktime Player will both handle 48 KHz fine.

I'm hoping though that the codec supports 24 bit and sampling rates larger than 48 KHz. Then maybe higher end programs like Peak can make use of the codec with higher quality files. In film sound, it's not uncommon to find 500 GB, 1 TB, or larger digital sound libraries. If you could save 25%-50% with lossless compression, it would be worth it.

I wanted to post one more thought here for people doing research on this.

The lossless codec is obviously a variable bitrate. Some sounds will compress better than others. That's why my heavy guitar song with lots of frequency saturation only compressed 25%. While these other people have mentioned songs compressing as much as 50%.

You can think of this as similar to Stuffit or a Zip compressor. Obviously if one of those programs lost some of the data while compressing, they'd be totally useless. The thing that's extra cool about Apple's lossless codec is that it can be played back in real time with no prior decompression. (Unlike a Stuffit archive which must be decompressed first. Then you can make use of the files within.)

Post a comment