Precision audio ripping with abcde

I was recently offered a pair of AKG K702 cans, and decided to make sure my audio sources were up to par.
This prompted me to re-encode parts of my audio library using the lossless FLAC encoding, as opposed to WMA/MP3 192kbps earlier.

I thus needed a ripper/encoder, and decided to go for abcde:

$ echo "media-sound/abcde ~amd64" >> /etc/portage/package.accept_keywords
$ echo "media-sound/abcde aac cdparanoia flac id3tag lame musicbrainz replaygain vorbis" >> /etc/portage/package.use
$ emerge -av media-sound/abcde

Then following the advice found here, I went ahead and checked the required read offset for my drive:

$ emerge -av sys-fs/lsscsi
$ lsscsi | grep -F 'cd/dvd'
# look up the read offset for the drive in the list at:
# http://www.accuraterip.com/driveoffsets.htm

I then tweaked the configuration in ~/.abcde.conf:

# ~/.abcde.conf: abcde configuration file

# Actions to take: do the replaygain step (disabled by default)
ACTIONS=cddb,read,encode,replaygain,tag,move,clean

# Default to FLAC encoding
OUTPUTTYPE=flac

# Customize the filename format
OUTPUTFORMAT='${ARTISTFILE}/${ALBUMFILE}/${TRACKNUM} - ${TRACKFILE}'
VAOUTPUTFORMAT='Compilations/${ALBUMFILE}/${TRACKNUM} - ${ARTISTFILE} - ${TRACKFILE}'

# Don't translate spaces to underscores in filenames
mungefilename ()
{
	echo "$@" | sed s,:,\ -,g | tr / _ | tr -d \'\"\?\[:cntrl:\]
}

# Prepend a leading 0 to track # even with < 10 tracks
PADTRACKS=y

# Preserve relative volume differences between the tracks of an album
BATCHNORM=y

# Run on at most 5 cores
MAXPROCS=5

# Set read offset according to http://www.accuraterip.com/driveoffsets.htm
# Use `lsscsi` to identify the drive
CDPARANOIAOPTS="-O 667"

# Put the temporary .wav files on /tmp (SSD-backed)
WAVOUTPUTDIR="${TMPDIR:-/tmp}"

# Open the tray after ripping
EJECTCD=y
# Close the tray before ripping
pre_read ()
{
	eject -t
}

Note that most (all?) configuration options can be found in /etc/abcde/abcde.conf along with a brief description.

And then the magic:

$ abcde

The drive read offset may cause cdparanoia to spew out quite a lot of SCSI errors at the end of the last track, but the output file still seems to be fine.
However, let’s double-check against the AccurateRip database for safety. There is an ARFlac.pl script found at Hydrogen Audio which checks a FLAC-encoded album against the AccurateRip database.
First let’s comment the CDPARANOIAOPTS entry in the abcde configuration, rip a CD and check it using ARFlac.pl:

$ ./ARFlac.pl Pink_Floyd-The_Dark_Side_of_the_Moon.INACCURATE/
Pink_Floyd-The_Dark_Side_of_the_Moon.INACCURATE/:2962344:7476420:9939552:18230352:12527340:16899120:20692896:9103416:9996000:5847660:
Checking AccurateRip database

Track   Ripping Status          [Disc ID: 000f8f74-760a110a]
 1      ** Rip not accurate **   (confidence -56)    [84dc4e66] [18823f25]
 2      ** Rip not accurate **   (confidence -56)    [61022134] [d55869e9]
 3      ** Rip not accurate **   (confidence -56)    [627e3310] [a7c577ce]
 4      ** Rip not accurate **   (confidence -56)    [177232d3] [7698149c]
 5      ** Rip not accurate **   (confidence -56)    [87b85a58] [a745c453]
 6      ** Rip not accurate **   (confidence -56)    [f0e8d520] [58073ba7]
 7      ** Rip not accurate **   (confidence -56)    [15e08776] [364c9aab]
 8      ** Rip not accurate **   (confidence -56)    [f12f4bf2] [5851c3b1]
 9      ** Rip not accurate **   (confidence -56)    [def0efff] [f759de20]
 10     ** Rip not accurate **   (confidence -56)    [24bbe552] [73924ffd]
Your CD disc is possibly a different pressing to the one(s) stored in AccurateRip.
Track(s) Accurately Ripped: 0
**** Track(s) Not Ripped Accurately: 10 ****
Track(s) Not in Database: 0

Ouch. Now with the read offset in CDPARANOIAOPTS:

$ ./ARFlac.pl "Pink Floyd/The Dark Side of the Moon/"
Pink Floyd/The Dark Side of the Moon/:2962344:7476420:9939552:18230352:12527340:16899120:20692896:9103416:9996000:5847660:
Checking AccurateRip database

Track   Ripping Status          [Disc ID: 000f8f74-760a110a]
 1      Accurately Ripped  (confidence 86)  [ca4ccf0a]
 2      Accurately Ripped  (confidence 85)  [c8891a92]
 3      Accurately Ripped  (confidence 86)  [3aee1393]
 4      Accurately Ripped  (confidence 85)  [4b37d200]
 5      Accurately Ripped  (confidence 85)  [e7be89df]
 6      Accurately Ripped  (confidence 85)  [6a5c6bb8]
 7      Accurately Ripped  (confidence 85)  [0fa68472]
 8      Accurately Ripped  (confidence 85)  [e22f112d]
 9      Accurately Ripped  (confidence 85)  [e6bfb1a9]
 10     Accurately Ripped  (confidence 85)  [598e31e2]
All Tracks Accurately Ripped.

Hooah!

Off to ripping my whole library now. :)

4 thoughts on “Precision audio ripping with abcde

  1. Many thanks for this article – it was a great help!!! I’m a keen fan of abcde now – thanks to you :-)!!!

  2. This helped me today ;)

    I tried whipper and its predecessor but seems that abcde with a hint from this post is producing just the same Accurately Ripped files!

  3. Of course you know that after ripping with an offset and wanting later to burn the CD you have to write with an -offset what linux currently can’t do.

Leave a Reply to Johnny Cancel reply

Your email address will not be published. Required fields are marked *