Ask the iTunes Guy: Compression and lossless encoding

[Ask the iTunes Guy is a regular column in which we answer your questions on everything iTunes related. If there’s something you’d like to know, send an email to the iTunes Guy for consideration.]

The idea of file compression—and what file types iTunes works with—can be confusing. In this installment, I answer your questions about lossless audio compression and file formats.

Sorry to be such a dummy, but could you define ‘lossless’ for me?

Lossless file compression is a technique that reduces the space of a file without changing any of its contents. For example, if you have a Word file with the text of Henry David Thoreau’s Walden, this file takes up 582KB. If you compress it using OS X’s Zip compression feature, the resulting file is 233KB. But when you expand this archive later, you’ll end up with every single character from the original file—no data is lost.

In music, similar compression techniques are used for lossless files. If you create an Apple Lossless or FLAC (Free Lossless Audio Codec) version from an uncompressed AIFF or WAV file (from a CD, say) the song will typically run 50 percent to 60 percent the data size of the original, yet when you play it back, you’ll enjoy every bit of data from the original. Compare that with with lossy compression—formats such as MP3 or AAC—where some musical data is removed to save even more space. This said, at a good bit rate—say 256-kbps—most people won’t hear the difference between a compressed file and an original from a CD.

I ripped all my CDs in Apple Lossless format into their own iTunes library for archival purposes, and have the same music at lower bit rates in another library, which I use for syncing to my iPhone. Now that iTunes offers the ability to convert those lossless files to 128-, 192-, or 256-kbps AAC files, how do I merge my two iTunes libraries in such a way that I don’t end up with two copies of each track, just the lossless versions when there are two of the same tracks?

Indeed, the option in iTunes 10.6 that lets you convert music on the fly to your choice of three bit rates (previously Apple only offered a 128-kbps option) makes it unnecessary to keep two libraries for most users.

To simply merge your libraries (and if you don’t care about play counts, last played dates, or ratings) locate in the Finder the folder containing the lossless files and drag that folder into the iTunes window. After you’ve added all your music to the same library, click the Music library icon in the iTunes source list, then make sure you have the Kind column visible (View -> View Options, check Kind). Next, choose File -> Display Duplicates and iTunes will show a list of what it thinks are tracks in your library with duplicate versions. Look at each pair of duplicates, and if they look accurate, click the Kind column header to sort the duplicates list by file type. You’ll want to keep the ones with the kind ‘Apple Lossless audio file’ and delete the others.

If you’re not satisfied with iTunes’s accuracy in identifying duplicates, you may want to turn to Doug Adams’ $8 Dupin Lite (available exclusively on the Mac App Store), which gives you much better control over finding and zapping dupes.

Let’s assume I rip a CD using the iTunes AAC encoder and later choose to rip CDs with Apple Lossless encoding. Even though iTunes offers as an option under the Advanced menu to create an Apple Lossless encoded version of my AAC formatted tunes there will be absolutely no difference in sound quality, right?

Right. You can’t improve the quality of a track you’ve already ripped. What iTunes displays in the Advanced menu is simply the format of your current import settings (iTunes -> Preferences -> General -> Import Settings). While this will make the conversion, it won’t change the music in any way.

On the other hand, if you had files in your iTunes library in Apple Lossless format, and set your import settings to AAC, that menu item would convert them from lossless files to lossy AAC files.

I like to listen to 24-bit music but these are only available for purchase as FLAC files. I prefer to use iTunes for playback since I can stream it around the house and control it from iOS devices. I’ve been converting them to 24-bit Apple Lossless using Max. Does converting it lose any quality?

No, converting from one lossless format to another retains the full quality. However, you should make sure that, when you play back these files, you have made the appropriate setting in the Audio MIDI Setup application (you’ll find it in the Utilities folder in Applications). You need to set your output to the appropriate sample rate (most likely 96000 Hz) and bit rate, otherwise your Mac will play back these files as though they were standard lossless files, and not high-resolution files.