Tuesday, August 28, 2007

How To Rip A CD

This might seem like one of the most mundane and obvious tasks, right? You just stick the disc in your computer and let iTunes or Windows Media Player do the rest. Sure, you can do that... if you don't care at all about the quality of what you put into your ears. I don't consider myself to be an audiophile, but I am very concerned about making sure the song I'm listening to via my iPhone, iPod or computer is indistinguishable (to me) from the way it was intended to be heard directly from the CD. This is not as simple of a goal as it may seem.

Here is a nice description of the problem. If you want a bit perfect copy of a track (meaning, exactly the same data that makes up the song on the disc) as starting material for whatever compression format you choose, you have to use software like CD Paranoia or EAC to rip the track to a file. I use EAC v0.95 beta 4 as my ripping application of choice. It, when combined with AccurateRip, virtually guarantees an exact duplication of the audio data. Basically, EAC reads the data from the disc as reliably as possible and then compares the result on a track-by-track basis with the version obtained from other AccurateRip users. If the version of the file you obtain compares exactly to the version obtained by someone else using a different computer and different disc, it is safe to say that file truly is an exact duplication of the data from the disc.

Okay, so now that I have an application to use to rip the data, what do I do with it? I rip the tracks from the CD to FLAC files. If you think about it, ripping the track is the most important part of the process. Once you've extracted the song from the CD and are confident it is a perfect version of the source material, you can convert it in any way you want later on. If you rip directly to a lossy format, like AAC or MP3, you are counting on the fact that you never damage or lose your original CD. I prefer to have the FLAC files as a backup. It also makes it MUCH easier if I should decide to re-encode to a different lossy format or better version of the same lossy format down the road.

I don't just encode directly to a lossy format from the FLAC source. This article summarizes the problem nicely. First, I use foobar2000 to perform a ReplayGain analysis of the files. It stores both track and album gain adjustments to the metadata in each of the FLAC files. I then apply the album gain adjustment to each track when finally encoding it to a lossy format. The reason for applying the album gain is that some tracks are meant to be quieter or louder in relation to the other tracks from the same album.

I have tried both MP3 and AAC compression. I originally decided upon MP3 since that format is virtually universally playable and if you use LAME as the encoder at one of its transparent settings, the result is virtually indistinguishable from the original recording. However, I have found problems with MP3 concerning the way various applications (Windows Media Player) can mess with the tags in the file. The problem stems from the fact that the tag format has multiple versions and not every application seems to play nicely when it comes to using them. Furthermore, MP3 is an aging format. Even with an encoder as good as LAME, there are technical limitations to the standard. I performed my own ABX listening test using a variety of source material with my Shure E2c earphones (the best "speakers" I have). I have found, for my own purposes, that I cannot tell the difference among the original FLAC file, a 160 kbps VBR AAC version of the file or a 225 kbps VBR MP3 version of the file. What does that mean? I now use AAC since it sounds identical to the original recording and doesn't take up much space. Again, not just any old AAC encoder will do. I have done some research on the topic and it seems that the free Nero Digital Audio Codec does the best job of producing high quality AAC tracks.

The last step in this process is to obtain high quality album art and embed it in each file. I have found that the iTunes store is generally one of the best places to get art. Most of the art obtained from there is 600x600 pixels in size and suffers from very few compression artifacts. The problem with iTunes, however, is that it doesn't actually embed the image in the file. This is fine if you only use Apple software or hardware to listen to the music since it will move a copy of the image with the songs for you, but I tend to prefer to have the art actually contained within the metadata of each track. I use iTunes to retrieve the art; then I extract the art from iTunes and save it off as a separate image file. I then use iTunes to embed the art directly into the metadata. If iTunes doesn't have the art, I have found that Amazon is the next best place to look. They offer 500x500 size images at the highest resolution, but they can still be of very good quality.

The end result is a portable, album gain adjusted, virtually indistinguishable from the original version of each track from a given album that contains the highest possible quality album art I could find. Here is a summary of the process in stepwise form:

Using EAC with AccurateRip:
1) Rip CD to a collection of FLAC files.

Using foobar2000:
2) Perform ReplayGain analysis of FLAC files.
3) Apply album gain and encode to AAC using the Nero Digital Audio encoder.

Using iTunes:
4) Find the album art and embed the art in each file.
5) Enjoy the music.

If you want to know more about any of the settings you should use for EAC, foobar2000, Nero, LAME, etc. I suggest first reading the forums at Hydrogenaudio. It is an excellent source of information and many of the developers that work on this software actively participate in discussions there.


grantbob said...

No pictures... needs a picture.

Kim said...

Geez...you really are a geek! Sounds like a lot of trouble, but it explains why ripping songs with iTunes plays them at a lower volume than those I actually paid for.

Hans said...

Simultaneously fascinating and sad... Ditto the "pictures for the illiterati please" request.