I recently needed to rip an audio CD (yes, those things still exist). Here’s what it took using Linux command line on an Ubuntu derivative distribution.
Step 1. Install the necessary software:
sudo apt-get install cdparanoia lame
There are two pieces of software being installed here; cdparanoia will copy audio tracks from the CD into *.wav files, while lame will convert *.wav files to a more compact *.mp3 format.
Step 2. Insert the CD into the drive and see if cdparanoia can read it:
cdparanoia -vsQ
If the CD is readable, a bunch of data about the disk and a listing of tracks will be output.
Step 3. The actual ripping of the CD:
cdparanoia -B
This will create a series of *.wav files in the current directory. The files will be named track01.cdda.wav, track02.cdda.wav, and so forth. They can be renamed if necessary, but for now, we’ll just let them be.
Step 4. Make the *.mp3 files using lame.
There’s a small problem with lame; it expects to work with one file at a time, like this:
lame track01.cdda.wav
To work around it, we can ask lame to work inside a loop. Say, we have a bunch of *.wav files in a directory and we want encode them all into *.mp3. This can be accomplished using a shell loop:
for t in *.wav; do lame $t; done
If we only want to encode, say, first three tracks we just ripped, we can specify a more restrictive track selection pattern:
for t in track{01..03}*.wav; do lame $t; done
When the command completes, the current directory will contain *.mp3 files with names matching the names of *.wav files we asked lame to encode. For example, there will be track01.cdda.mp3 next to track01.cdda.wav, track02.cdda.mp3 next to track02.cdda.wav, and so on.
Concluding note. Both cdparanoia and lame have plenty of command-line options not covered here. Using those options, one can rip selected tracks or even parts of a track, specify bitrate and mode for the encoding, and lots of other things…