@bytesnz

Jack Farley, Web Application Engineer

Abcde

Introduction

abcde is a great program for ripping cds. I have used many GUI programs, including grip. kaudiocreator and winamp. None of these have quite met my wants though. abcde comes very close to meeting them though and with a few modifications, I have now got my perfect cd ripper. Below are my configuration and modifications.

Configuration file (.abcde.conf)

Below is my abcde configuration. It is set up to encode the files using FLAC. Why FLAC? Because it is lossless, compressed (to a certain extent) and completely open and free. Big ups to Andrew Strong for the configuration file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# -----------------$HOME/.abcde.conf----------------- #
#
# A sample configuration file to convert music cds to
# FLAC using abcde version 2.5.3
#
# http://andrews-corner.org/abcde.html
# -------------------------------------------------- #
# Specify the encoder to use for FLAC. In this case
# flac is the only choice.
FLACENCODERSYNTAX=flac
# Specify the path to the selected encoder. In most cases the encoder
# should be in your $PATH as I illustrate below, otherwise you will
# need to specify the full path. For example: /usr/bin/flac
FLAC=flac
# Specify your required encoding options here. Multiple options can
# be selected as '--best --another-option' etc.
FLACOPTS='--verify --best'
# Output type for FLAC.
OUTPUTTYPE="flac"
# The cd ripping program to use. There are a few choices here: cdda2wav,
# dagrab, cddafs (Mac OS X only) and flac.
CDROMREADERSYNTAX=cdparanoia
# Give the location of the ripping program and pass any extra options:
CDPARANOIA=cdparanoia
CDPARANOIAOPTS="--never-skip=40"
# Give the location of the CD identification program:
CDDISCID=cd-discid
# Give the base location here for the encoded music files.
OUTPUTDIR=".../music"
# The default actions that abcde will take.
ACTIONS=cddb,read,encode,tag,move,replaygain,clean
# Decide here how you want the tracks labelled for a standard 'single-artist',
# multi-track encode and also for a multi-track, 'various-artist' encode:
OUTPUTFORMAT='${OUTPUT}/${ARTISTFILE}/${ALBUMFILE}/${DISCNUMBER}${TRACKNUM} - ${TRACKFILE}'
VAOUTPUTFORMAT='${OUTPUT}/Various/${ALBUMFILE}/${DISCNUMBER}${TRACKNUM} - ${ARTISTFILE} - ${TRACKFILE}'
# Decide here how you want the tracks labelled for a standard 'single-artist',
# single-track encode and also for a single-track 'various-artist' encode.
# (Create a single-track encode with 'abcde -1' from the commandline.)
ONETRACKOUTPUTFORMAT='${OUTPUT}/${ARTISTFILE}/${ALBUMFILE}/${ALBUMFILE}'
VAONETRACKOUTPUTFORMAT='${OUTPUT}/Various/${ALBUMFILE}/${ALBUMFILE}'
# Create playlists for single and various-artist encodes. I would suggest
# commenting these out for single-track encoding.
#PLAYLISTFORMAT='${OUTPUT}/${ARTISTFILE}-${ALBUMFILE}/${ALBUMFILE}.m3u'
#VAPLAYLISTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${ALBUMFILE}.m3u'
# Put spaces in the filenames instead of the more correct underscores:
mungefilename ()
{
echo "$@" | sed s,:,-,g | tr / _ | tr -d \'\"\?\[:cntrl:\]
}
# What extra options?
MAXPROCS=2 # Run a few encoders simultaneously
PADTRACKS=y # Makes tracks 01 02 not 1 2
EXTRAVERBOSE=y # Useful for debugging
EJECTCD=y # Please eject cd when finished :-)

abcde Tweaks

So, there were a few things that I wanted to add to abcde. Being a bash script, I could. I tweaked:

  • the functionality of -W option so that it didn’t add a comment to the album and so it doesn’t change the track numbers (ie not -T #01 -w \"CD #\")
  • the way that abcde stores the artists
  • abcde so that if any track titles have a featuring artist in them, it removes them from the title and adds them as a artist to the track.
    Below is the diff of the tweaks I made against version 2.5.4-1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
903,905c903,936
< echo ARTIST="$TRACKARTIST"
< echo ALBUM="$DALBUM"
< echo TITLE="$TRACKNAME"
---
> # Split up track artists (based on &amp;)
> aCount="${TRACKARTIST//[^&amp;]}"
> aC=${#aCount}
> if [ $aC -ne 0 ]; then
> TRACKARTIST=`echo $TRACKARTIST | sed -r -e 's/[ ]+\&amp;/\&amp;/g;s/\&amp;[ ]+/\&amp;/g'`
> i=1
> while [ $i -le $(($aC+1)) ]; do
> echo ARTIST=`echo $TRACKARTIST | cut -d '&amp;' -f $i`
> i=$(($i+1))
> done
> else
> echo ARTIST=$TRACKARTIST
> fi
> #echo ARTIST="$TRACKARTIST"
>
> echo ALBUM=$DALBUM
>
> # Put featuring artist as an artist
> regB='^(.*) \((ft.|feat.|featuring) (.*)\)$'
> regN='^(.*) (ft.|feat.|featuring) (.*)$'
> if echo $TRACKNAME | grep -q -P "$regB"; then
> reg=$regB
> elif echo $TRACKNAME | grep -q -P "$regN"; then
> reg=$regN
> fi
>
> if [ "$reg" ]; then
> echo TITLE=`echo $TRACKNAME | sed -r -e "s/$reg/\1/"`
> echo ARTIST=`echo $TRACKNAME | sed -r -e "s/$reg/\3/"`
> else
> echo TITLE=$TRACKNAME
> fi
> #echo TITLE="$TRACKNAME"
>
3450,3452c3481,3483
< STARTTRACKNUMBER="${OPTARG}01"
< STARTTRACKNUMBERTAG="y"
< COMMENT="CD${OPTARG}"
---
> #STARTTRACKNUMBER="${OPTARG}01"
> #STARTTRACKNUMBERTAG="y"
> #COMMENT="CD${OPTARG}"