Bulk CD Ripping -- Part One: CDs to FLAC Images
This is going to be a multipart blog series on ripping CDs. I'll start be describing the goals that lead me to this solution:
- Use a hardware changer to rip the CDs so that I don't need to sit there and feed the computer each disk one at a time.
- Use ripping software which detects and corrects for errors during ripping caused by scratches or fingerprints on the CDs.
- Rip to a lossless format so that the files can be converted to any audio format at any point in the future.
- Each ripped disk should be represented by a single file (instead of a file per track) so that an exact copy of the CD can be burned in the future if that need arises.
- Use the most reliable tagging (metadata) database available so that the CDs end up with consistent and accuate titles.
Part one talks about the first four bullet points. Part two will expand on the last bullet point.
I had some vacation time to burn and rather than doing something useful like going on a long bike ride, remodeling the downstairs bathroom, or even reading a few novels I decided to rerip all of our music. Since I'm a software developer and not a CD changer I decided to buy new hardware and then write software to make it all work.
I ordered a Sony VGP-XL1B2 Media Changer from Amazon. This is a 200 disk CD/DVD changer designed for Windows Media Center machines. It connects to your computer via firewire (1394). The changer isn't supposed to work under Windows XP and I didn't want to use Media Center for ripping, but I figured that I could make it work anyway. What really convinced me was this blog post from Matt Goyer which described the interface that the changer's driver must provide to Windows.
I ordered the changer and it arrived the next day (thanks to Amazon Prime's $3.99 overnight shipping). When I plugged it into a Windows XP SP2 machine I was surprised to see it work without needing to install any drivers. A service called the Removable Storage Manager (RSM) detected it and seemed to start doing something with the CDs. I wasted about two hours playing with RSM before deciding that it was overly complicated for what I needed. So I decided to write my own tool to control the changer.
Using information from Matt Goyer's blog post and MSDN I was able to write a small program called MediaChanger (the zip in that directory contains source and a debug binary). MediaChanger supports the following commands:
- MediaChanger mount <slot> -- This mounts the disk in slot <slot> into the drive.
- MediaChanger unmount -- This puts the currently mounted disk back to the slot that it came from.
- MediaChanger drivestatus -- Reports if the drive is empty or full and where the disk came from.
- MediaChanger next -- Unmounts the current disk and mounts the next one.
This provides enough changer support for a shell script to mount each disk one by one and do something with them. That provided the basis for ripping all of our disks.
Now the problem was automating my preferred ripper, Exact Audio Copy (EAC). EAC is the best audio ripper for CDs if you care about getting perfect rips with no errors. It is not always fast, but it always does a good job. It also supports ripping to a format called WAV+CUE which is a WAV file with all of the music and a text file called a CUEsheet that has the table of contents from the disk. We need WAV+CUE support to create FLAC images.
Sadly EAC is not designed to be scripted, which makes using it with my MediaChanger program a little difficult. A couple of friends pointed me to a script called REACT. REACT is written in a scripting language called AutoIt and adds features to EAC by watching dialog boxes and using menu items as a human would. This is a really ugly way to script something, but it is also the only option available for EAC. I modified REACT to add the following features:
- When finished ripping a disk switch to the next one and start ripping (this is turned on by pressing Alt-F5). This is built on top of REACT's existing feature of ripping an image by pressing F10.
- When EAC finds multiple hits for a CD in CDDB use the first one.
- If there is no CDDB information for a CD then title the CD after the slot that it came from.
I'm using REACT to generate FLAC images from the WAV+CUE ripped by EAC. This produces a single FLAC file which contains all of the data from the CD. In part two of this series I'll explain how I tag and convert my FLAC images into MP3 files.
With these changes REACT was ready for bulk CD ripping from the changer. I loaded up the changer with a drawer full of CDs from our CD cabinet and let it run. The drive in the changer is not very fast at audio extraction, so it takes about 24 hours for it to rip 200 CDs. This is a little longer than I hoped for it, but at least I don't have to sit there while it runs.