Hack 26. Get a Grip on CD Ripping
Use the Grip program to automate all of your CD ripping tasks.
The command line is definitely a powerful tool, particularly for automation, but it can also make doing some tasks, like ripping a CD, more trouble than it's worth, especially if you plan on tagging the resulting audio with metadata such as ID3 tags. While there are several frontends to command-line tools, Grip, in my opinion, is an excellent example of a GUI frontend that balances the power and configurability of the command line, with the ease of use of a GUI interface. After you get to the end of this hack, your CD-ripping process will be so automated that once you start, you won't even have to pick up a mouse.
Grip is a pretty common program, so your Linux distribution will likely have it packaged for you already. Otherwise, you can download the latest version of Grip from the official web site at http://nostatic.org/grip. Grip is a frontend in that for the most part, it uses other command-line utilities behind the scenes to do all of the work and simply provides an easy-to-use interface to configure what commands it passes down to those tools. Because it is a frontend, Grip can make use of many different command-line CD ripping programs and WAV encoder programs and, as such, it supports ripping to a number of popular formats including MP3, Ogg Vorbis, FLAC, or even a custom encoder of your choosing. This also means that to use those tools, you will need to already have them installed.
2.15.1. Configure Grip
Before you rip your first CD, you will need to configure Grip. Grip's main interface is broken into a number of tabs:
To configure Grip, click the Config tab to reveal a number of sub-tabs that configure different Grip settings. The tabs we are interested in are CD, Rip, Encode, ID3, and DiscDB. The first tab, CD, lets you configure your CD device. For the most part the default settings will work, but for the purposes of automated ripping make sure that the "Auto-play on disc insert" option is off. To test whether Grip has the correct CD-ROM device, insert a CD and see whether Grip sees and can play it. If not, make sure /dev/cdrom is pointing to your correct CD-ROM device, often /dev/hdc or /dev/scd0.
The Rip configuration tab is where things start to get interesting. Because so many people are used to automated programs that turn their CDs into MP3s, they often don't realize it is a two-stage process: first ripping the tracks from the CD into WAV files, and then encoding the tracks to MP3, Ogg, or whatever other format you wish. This tab controls the ripping stage of the process, and most of the options are pretty self-explanatory.
The first sub-tab, Ripper, lets you configure which CD-ripping program to use. Grip now includes its own version of cdparanoia by default, and I recommend that you use it unless you have a good reason not to. cdparanoia by default rips more slowly than most other ripping programs (on most of my CD-ROM drives it rips at 2x), but what it loses in speed, it more than makes up for in accuracy. cdparanoia is slow because it is particularly thorough about getting every bit it can from the CD. If you rip with faster but less thorough ripping programs, you might notice pops or gaps in your tracks. Even on many of my scratched-up CDs, cdparanoia has been able to recover the track. If you want more information about cdparanoia, see [Hack #24].
Once you choose your CD-ripping program, you can configure it further in the Ripper tab. In the case of cdparanoia, you can disable a number of its default options, including what it calls "paranoia" and "extra paranoia" how thorough it is about reading the CD. I recommend you leave those and the scratch detection and repair options alone. The primary option in this sub-tab you should be interested in configuring is the "Rip file format" option. Here you can tell Grip where to put and how to name the WAV files it rips. Grip uses a number of variables that correspond to metadata from the CD. Table 2-4 lists a number of the common variables and what they represent.
For example, if you stored your MP3s in a directory called mp3 in your home directory, you might put in this field:
Decoded, that line would turn Track 10 of the London Calling CD by The Clash, called "The Guns of Brixton" into the file ~/mp3/the_clash/1979-london_calling/10-the_guns_of_brixton.wav
With this sub-tab configured, click the Options sub-tab to get to other ripping options. There are a few options here that I like to enable, particularly Auto-rip on insert and Auto-eject after rip. With these options enabled, when Grip is running it will automatically start ripping a CD for you when you insert it, and then eject it when it's done. This means that once the rest of Grip is configured, you can set up a stack of CDs at your desk, start Grip, insert the first CD, and then minimize it and do something else. When you see that the CD has ejected, just replace it with another CD to rip and go on with what you where doing. Grip will handle the rest. It doesn't get much more automated than that!
The next main configuration tab is Encode. This tab lets you configure what audio files Grip will encode the WAV files into. The first option, Encoder, lets you choose what encoding program to use. What you choose here depends heavily on what encoding programs you have installed, and what kind of audio files you want. For instance, if you want to make MP3s, you will likely choose LAME, mp3encode, or your favorite MP3 encoder. I usually stick with LAME because it is fast and produces decent-quality MP3s. If you want to create Ogg Vorbis files, choose oggenc. If you want to create FLAC files (a lossless audio codec so there is no degradation in quality) choose flac. After you have chosen the encoder to use, make sure the encoder executable path points to where your encoder is (the default should be fine here). The defaults for the next two options, the encoder command line and file extension, should be fine unless you choose to use a special encoder not directly supported by Grip. The next field, "Encode file format," takes the same type of information as the similar field in the Rip tab. In fact, if you make sure to use %x as the file extension, you can likely just directly copy and paste from the same field under the Ripping tab.
In the Options tab for Encode, you can configure some specific options for your encoder. Probably the most important option in this tab is the "Encoding bitrate" option, which determines the bitrate at which to encode your audio file if you use a lossy encoding such as MP3 or Ogg. What you put here is largely a matter of taste, although the higher the number, the larger your resulting file will be. In the case of MP3s, some people can't tell the difference between 128 and 256 kilobits per second. For other people, the distinction is great. I usually use 192 or 256 kilobits per second here, but you might want to experiment with the output for your audio files and determine what bitrate is best for youyour choice may vary depending upon the type of music you are encoding. In this tab you also have the option to create an .m3u playlist file for each CD you rip and choose where to put the playlist file. Generally, the only other option I enable in this field is "Delete .wav after encoding."
The next major configuration tab, ID3, lets you control whether Grip inserts ID3 tags into your audio files. Generally this is a good thing, and you will want all these options enabled unless you want to go back later and manually set ID3 tagsan often tedious process.
The final configuration tab you might want to configure is the DiscDB tab. This tab lets you configure the primary and secondary CD database servers that Grip will query when you insert a CD. These servers contain information on many CDs, based on CD signatures. When you insert a CD, Grip will query this database and retrieve artist, disc, and track information for the CD so that it can automatically fill out the ID3 tags and name the files appropriately. I would recommend sticking with the default servers listed here unless you know what you are doing. Make sure that the "Perform disc lookups automatically" option is enabled here.
2.15.2. Rip a CD
Once you have configured Grip, the process to rip a CD is rather simple just insert the CD into the CD-ROM drive. Grip will automatically scan the CD, retrieve the track information from your CD database servers, select all tracks for ripping, and start the ripping and encoding process. You can click on the Rip tab to watch the progress of both the ripping and encoding to monitor how far along in the process you are. If for some reason you want to stop the ripping process, click the "Abort Rip and Encode" button.
As I mentioned before, the nice thing about configuring Grip in this way is that you can let it run virtually unattended and just feed it new CDs until all your CDs are rippedwhich certainly beats typing long commands and editing ID3 tags by hand!