Linux Rip Audio CD

in Categories Multimedia last updated June 17, 2010
# A simple shell script to rip audio cd and create mp3 using lame 
# and cdparanoia utilities.
# ----------------------------------------------------------------------------
# Written by Vivek Gite <>
# (c) 2006 nixCraft under GNU GPL v2.0+
# ----------------------------------------------------------------------------
read -p "Starting in 5 seconds ( to abort press CTRL + C ) " -t 5
cdparanoia -B
for i in *.wav
	lame --vbr-new -b 360 "$i" "${i%%.cdda.wav}.mp3"
	rm -f "$i"

How Do I Use This Script?

Download the script. Put audio cd into drive. Create directory to store mp3s, enter:
mkdir music
cd music
mkdir "Album name"
cd !!:1

See HowTo: Linux Rip and Encode Audio CDs

Share this on:

4 comment

  1. The script should read

    # A simple shell script to rip an audio CD and create MP3s using lame
    # and cdparanoia.
    # ----------------------------------------------------------------------------
    # Written by Vivek Gite  and WS
    # (c) 2011 nixCraft under GNU GPL v2.0+
    # ----------------------------------------------------------------------------
    read -p "Starting in 5 seconds (to abort press CTRL + C)" -t 5
    if ! cdparanoia -B; then
    	echo "cdparanoia ended with error, bailing out" 1>&2
    	exit 1
    for i in *.wav; do
    	if lame --vbr-new -q 0 "$i" "${i%%.cdda.wav}.mp3"; then
    		rm -f "$i"
    		echo "Could not encode $i" 1>&2
    exit $rc

    I corrected spelling and added error checking. The script will now abort on a ripping error and won’t delete Wave files which have not been successfully encoded.
    If any error occurs, the exit code is not 0.
    Furthermore, “–vbr-new” and “-b 360” are contradictory options, the first telling lame to use variable bit rate and the second telling lame to use constant bit rate for encoding. I replaced the second with “-q 0” to achieve the best possible result.
    The usage example could be simplified with

    mkdir -p "music/Album name"
    cd $?

    Have a question? Post it on our forum!