Rip Audio CDs to MP3s

Converting audio CDs to MP3 consists of two steps:

  1. rip the audio tracks from the cd and save them as wave file
  2. convert the wave files to mp3 files

The tools required for these two steps are cdparanoia and lame. The graphical front-end ripperx can be used which also provides the option to add artist and title details and write mp3 tags.

Installation of the required tools (if graphical front-end is not required, remove ripperx):

apt-get install cdparanoia lame ripperx

To rip and convert a cd on the command line:

cdparanoia -B
#to extract only part of a track like time 0:13.13-1:13.00 from track 1, you can use
#cdparanoia "1[:13.13]-1[1:13]"
for t in *.wav; do lame -b 192 -h -V 6 $t; done

Flac to MP3 conversion

To convert lossless FLAC files to mp3, the easiest option is using ffmpeg which will most likely already be installed. This script/command converts all flac files in a directory to MP3 V0 with variable bitrate between 220-260kbps. The resulting compacted audio file cannot be distinguished from the lossless version.

#!/bin/bash
for a in ./*.flac; do
  < /dev/null ffmpeg -i "$a" -qscale:a 0 "${a[@]/%flac/mp3}"
done