I realized recently that I still had 650GB or so left on my 2TB hard drive in my media center, so I decided that in order to use up some of that space I could rip my CD collection to FLAC. For those who don’t know, FLAC stands for the Free Lossless Audio Codec. It’s basically saying, “Hey, we’re going to copy the music files off the CD at the highest quality possible, and then give it the ability to store metadata”. Normally if you use something such as iTunes to rip your CD’s it compresses it using a lossy codec. I previously ripped my collection at 320kbps M4A, which is absolutely indistinguishable to the human ear compared to a lossless codec that usually has a bit rate of 900kbps or higher. But for the people that know me, it doesn’t matter if it’s indistinguishable, I will make something big and complex just for the fun of it. Besides, imagine if one of my discs were damaged or lost, now I can just go on my computer and convert it to any format I want!

So lets dive into it shall we? On my media center I am running Ubuntu 10.10 Maverick Meerkat, though I would assume this method would work on any Debian-based Linux distribution. The first thing we will want to do is grab a couple of packages, flac and abcde. FLAC is obviously the FLAC codec we will want to rip our songs with, but we need a tool to rip it with… that’s where Abcde comes in (short for A Better CD Encoder). Open up Terminal, and enter the following line:

sudo apt-get install flac abcde

I prefer apt-get, but aptitude and other package installers will work also.

Now we’re going to want to create a config file, so you’re going to want to type this too into Terminal:

sudo gedit ~/.abcde.conf

And you’re probably going to want to make a directory to store the ripped files in:

mkdir ~/Ripping

Next, paste the following lines into the text editor:


Save it, then you’re going to want to move into the “Ripping” directory and start a new file names “rip.sh”

    cd ~/Ripping/
    sudo gedit rip.sh

Paste the following into rip.sh:

    while [ 1 ]
      eject /dev/sr0
      echo "Insert Disc, then press the enter/return key."
      read input
      eject -t /dev/sr0

We will make rip.sh executable, then we will want to run it:

    sudo chmod +x rip.sh
    sh rip.sh

The first thing that rip.sh will do is eject anything that’s in the drive, then you can put in your audio CD into the tray, press enter, the tray will close, and then the CD will begin to rip. After the CD is done ripping, the drive will eject and you will be asked to insert another CD.

This will run forever… it won’t magically detect when you reach the end of your jewel case stack. In order to stop it, you can either close the Terminal window, or you can press Control+C while the Terminal window is active.

And that’s it! You can now automate your CD ripping! Now if you could somehow make a robotic arm that would grab a CD from a stack and insert it into a drive, then you would have a fully automated set up.

Lastly, I would like to thank all of the developers behind FLAC, and Robert Woodcock for developing Abcde. That set of tools is really cool. It grabs all the CD metadata from the web and automatically updates the tags, making ripping CD’s all the easier to do.