1. Andrew's Corner :

abcde: Command Line Music CD Ripping for Linux

I have tried a variety of programs to rip my personal collection of music from CD to computer. I found significant shortcomings with many of the GUI programs and throughout I was also a little nonplussed at the complexities of whole process. Fortunately I came across the script known as abcde which eliminates the needless froth of the GUI as well as seamlessly takes care of much of the complexity of the process. This small guide aims to demonstrate to Linux users how to harness this amazing script for their own purposes. I will describe on this page how to rip and encode music cds to five different music formats: MP3, Ogg Vorbis, FLAC, Musepack and AAC and to top it all off show how with a single command a music cd can be encoded to all five at the same time. I will also for the sake of completion demonstrate the syntax required to convert CDs that contain the spoken word to Speex. But first for some preliminary setup:

Setting it all up ...

abcde is actually a long shell script that manipulates a handful of programs. I am using version 2.5.3 for this guide which your distro may package or can be downloded from here. As well abcde itself you will need a selection of the other programs to match your encoding needs. Details of these programs are:

abcde
"A Better CD Encoder" = abcde! Ordinarily, the process of grabbing the data off a CD and encoding it, then tagging or commenting it, is very involved. The abcde script is designed to automate this.
cd-discid
cd-discid is a backend utility for getting CDDB discid information for a CD. It was originally designed by Robert Woodcock for cdgrab (now abcde), but can be used for any purpose requiring CDDB data.
cdparanoia
cdparanoia retrieves audio tracks from CDROM drives. The data can be saved to a file or directed to standard output in WAV, AIFF, AIFF-C or raw format. For the purposes of conversion abcde directs cdparanoia to produce WAV files.
EasyTAG
I will admit to using this excellent tagging program to sometimes "clean up" after abcde. id3v2, vorbiscomment and metaflac will do the same but EasyTAG does it so much quicker!
FAAC
FAAC is an open source MPEG-4 and MPEG-2 AAC encoder. It does not claim to be the best AAC encoder but it is the only one that currently works with abcde. Patches are available to enable NeroAacEnc to work with abcde as well.
FLAC Tools
FLAC (Free Lossless Audio Codec) is an audio format similar to MP#, but lossless, meaning that audio is compressed in FLAC without any loss in quality. flac is a command-line tool for encoding, decoding, testing and analysing FLAC streams. metaflac is used by abcde to add metadata to the FLAC files.
id3
An ID3 tag is a data container within an MP3 audio file stored in a prescribed format. This data commonly contains the Artist name, Song title, Year and Genre of the current audio file.
LAME
LAME is an open source application used to encode audio into the MP3 file format. A truly great program that is arguably the best tool for this particular job.
mkcue
mkcue generates CUE sheets from a CD TOC (Table Of Contents). It is a perfect companion for abcde to generate backups of your audio CDs using the FLAC codec and the single track option.
Musepack
Musepack is an audio compression format with a strong emphasis on high quality. It's not lossless, but it is designed for transparency, so that you won't be able to hear differences between the original wave file and the much smaller MPC file.
Vorbis Tools
Ogg Vorbis is a completely open, patent-free, professional audio encoding and streaming technology with all the benefits of Open Source. oggenc is the encoder for Ogg Vorbis files that will also write the comments at encoding time.
Speex
Speex is an Open Source/Free Software patent-free audio compression format designed for speech.

That is it for definitions. There is a wealth of details in the man pages for all these programs which I encourage you to consult. But now on to the nuts and bolts of the program:

Menus for abcde

abcde can be operated purely from the commandline but it is much easier to run the program from a configuration file. abcde looks for two of these files at startup: /etc/abcde.conf and $HOME/.abcde.conf. The file /etc/abcde.conf is a fully commented configuration file that is well worth looking at if only to copy to your home directory as $HOME/.abcde.conf (as is most usually done). But my gift to you, Gentle Reader, is a set of $HOME/.abcde.conf files that will achieve great results "straight out of the box" and will simply require the command abcde or abcde -1 to run the whole process:

  1. ~/.abcde.conf for MP3
  2. ~/.abcde.conf for Ogg Vorbis
  3. ~/.abcde.conf for FLAC
  4. ~/.abcde.conf for MPP/MP+(Musepack)
  5. ~/.abcde.conf for M4A/AAC
  6. ~/.abcde.conf for MP3 + Ogg Vorbis + FLAC + MPP/MP+(Musepack) + M4A/AAC
  7. ~/.abcde.conf for Speex

Feel free to use these and call them your own although I would encourage you to work on them a little and tweak them to match your own needs.

~/.abcde.conf for MP3

Who can escape MP3? I have placed this menu at the top of the list as I realise most people have MP3 players these days and many equate encoding with MP3. Bear in mind however that MP3 is a proprietary format and there are equally good formats that are totally free.

# -----------------$HOME/.abcde.conf----------------- #
# 
# A sample configuration file to convert music cds to 
#       MP3 format using abcde version 2.5.3
# 
#       http://andrews-corner.org/abcde.html
# -------------------------------------------------- #

# Specify the encoder to use for MP3. In this case
# the alternatives are gogo, bladeenc, l3enc, xingmp3enc, mp3enc.
MP3ENCODERSYNTAX=lame 

# 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/lame
LAME=lame

# Specify your required encoding options here. Multiple options can
# be selected as '--preset standard --another-option' etc.
LAMEOPTS='--preset extreme' 

# Output type for MP3.
OUTPUTTYPE="mp3"

# 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="$HOME/music/"               

# The default actions that abcde will take.
ACTIONS=cddb,playlist,read,encode,tag,move,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}/${TRACKNUM}.${TRACKFILE}'
VAOUTPUTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${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 :-)

The most obvious area to change is the MP3 encoding options but you will find that the example above will deliver perfectly acceptable sound on most systems. If you wish you can put your favourite MP3 recipe in place or go with the highest quality preset: --preset insane. For fuller information about these wonderful presets type in lame --preset help at your shell prompt.

~/.abcde.conf for Ogg Vorbis

This is the format that I use myself and I bought an iRiver X20 player specifically for its native support of the amazing Ogg Vorbis format. Arguably produces better sound than MP3 at a smaller file size and it is completely free.

# -----------------$HOME/.abcde.conf----------------- #
# 
# A sample configuration file to convert music cds to 
#       Ogg Vorbis using abcde version 2.5.3
# 
#       http://andrews-corner.org/abcde.html
# -------------------------------------------------- #

# Specify the encoder to use for Ogg Vorbis. In this case
# vorbize is the other choice.
OGGENCODERSYNTAX=oggenc

# 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/oggenc
OGGENC=oggenc

# Specify your required encoding options here. Multiple options can
# be selected as '-q 6 --another-option' etc.
OGGENCOPTS='-q 6'  

# Output type for Ogg Vorbis
OUTPUTTYPE="ogg"

# 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="$HOME/music/"               

# The default actions that abcde will take.
ACTIONS=cddb,playlist,read,encode,tag,move,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}/${TRACKNUM}.${TRACKFILE}'
VAOUTPUTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${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 :-)

Again the first are for change would be the -q 6 setting but I believe that most will be happy with the sound produced at this level. Options are from -1 to 10 or of course you can place your own custom ogg encoding options here.

~/.abcde.conf for FLAC

FLAC stands for Free Lossless Audio Codec and it is the only codec used here that does not remove material from the audio stream. I have not used it extensively myself as the trade off is large file size, but the sound quality cannot be matched by MP3 or ogg regardless of quality settings.

# -----------------$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="$HOME/music/"               

# The default actions that abcde will take.
ACTIONS=cddb,playlist,read,encode,tag,move,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}/${TRACKNUM}.${TRACKFILE}'
VAOUTPUTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${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 :-)

The warning remains: FLAC files sound very good but they are big. If you also wish to generate a cue sheet with a single-track encode you will need to have the program mkcue available to abcde and then run the following from the commandline: "abcde -1 -a default,cue", without the quotation marks of course. This certainly worked well enough on my own system.

~/.abcde.conf for MPP/MP+(Musepack)

I will admit that I am only just starting to experiment with Musepack but it produces great sound and fits in well with abcde. So here is an $HOME/.abcde.conf file to start your own exploration of this quality format:

# -----------------$HOME/.abcde.conf----------------- #
# 
# A sample configuration file to convert music cds to 
#  MPP/MP+(Musepack) format using abcde version 2.5.3
# 
#       http://andrews-corner.org/abcde.html
# -------------------------------------------------- #

# Specify the encoder to use for MPP/MP+ (Musepack). In this case
# there is no other choice.
MPPENCODERSYNTAX=mppenc 

# 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/mppenc
MPPENC=mppenc 

# Specify your required encoding options here. Multiple options can
# be selected as '--standard --fade 5' etc.
MPPENCOPTS='--extreme'

# Output type for MPP/MP+ (Musepack).
OUTPUTTYPE="mpc"

# 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="$HOME/music/"               

# The default actions that abcde will take.
ACTIONS=cddb,playlist,read,encode,tag,move,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}/${TRACKNUM}.${TRACKFILE}'
VAOUTPUTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${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 :-)

For those who wish to explore the Musepack encoding options a little more the command mppenc --longhelp will show the details. The first thing to manipulate might be the encoding options although this produces a perfectly adequate output file with a bitrate of about 210 kbps.

~/.abcde.conf for M4A/AAC

This section may change soon enough as I see that encoding with NeroAacEnc may be officially added to abcde in the near future. For the moment though encoding with faac will be used.

# -----------------$HOME/.abcde.conf----------------- #
# 
# A sample configuration file to convert music cds to 
#       m4a/aac using abcde version 2.5.3
# 
#       http://andrews-corner.org/abcde.html
# -------------------------------------------------- #

# Specify the encoder to use for m4a/aac. In this case
# faac is the only choice.
AACENCODERSYNTAX=faac

# 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/faac
AACENC=faac

# Specify your required encoding options here. Multiple options can
# be selected as '--best --another-option' etc.
AACENCOPTS='-q 250 -w -s'

# Output type for m4a/aac.
OUTPUTTYPE="m4a"

# 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="$HOME/music/"               

# The default actions that abcde will take.
ACTIONS=cddb,playlist,read,encode,tag,move,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}/${TRACKNUM}.${TRACKFILE}'
VAOUTPUTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${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 :-)

This produces a bitrate of about 220kb/s which is more than adequate for the average system. Note that the -s option I use in AACENCOPTS requires the most recent version of faac.

~/.abcde.conf for MP3 + Ogg Vorbis + FLAC + MPP/MP+(Musepack) + M4A/AAC

This one is the grandaddy of the all and is demonstration of the power of abcde. With this $HOME/.abcde.conf file a music cd is ripped and encoded to all five formats at the same time and the resulting albums are then sorted into five different subdirectories.

# -----------------$HOME/.abcde.conf----------------- #
# 
#   A sample configuration file to convert music cds to 
#      MP3, Ogg Vorbis, FLAC, Musepack & AAC 
#          using abcde version 2.5.3
# 
#       http://andrews-corner.org/abcde.html
# -------------------------------------------------- #

OGGENCODERSYNTAX=oggenc                # Specify encoder for Ogg Vorbis
MP3ENCODERSYNTAX=lame                  # Specify encoder for MP3
FLACENCODERSYNTAX=flac                 # Specify encoder for FLAC
MPPENCODERSYNTAX=mppenc                # Specify encoder for Musepack
AACENCODERSYNTAX=faac                  # Specify encoder for AAC

OGGENC=oggenc                          # Path to Ogg Vorbis encoder
LAME=lame                              # Path to MP3 encoder
FLAC=flac                              # Path to FLAC encoder
MPPENC=mppenc                          # Path to Musepack encoder
AACENC=faac                            # Path to AAC encoder

OGGENCOPTS='-q 6'                      # Options for Ogg Vorbis
LAMEOPTS='--preset extreme'            # Options for MP3 
FLACOPTS='--verify --best'             # Options for FLAC
MPPENCOPTS='--extreme'                 # Options for Musepack
AACENCOPTS='-q 250 -w -s'              # Options for AAC
 
OUTPUTTYPE="ogg,mp3,flac,mpc,m4a"      # Encode to all 5 formats!

CDROMREADERSYNTAX=cdparanoia            
CDPARANOIA=cdparanoia  
CDPARANOIAOPTS="--never-skip=40"

# Give the location of the CD identification program:       
CDDISCID=cd-discid           
                               
OUTPUTDIR="$HOME/music/"               
ACTIONS=cddb,playlist,read,encode,tag,move,clean
OUTPUTFORMAT='${OUTPUT}/${ARTISTFILE}-${ALBUMFILE}/${TRACKNUM}.${TRACKFILE}'
VAOUTPUTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${TRACKNUM}.${ARTISTFILE}-${TRACKFILE}'
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'

mungefilename ()
{
  echo "$@" | sed s,:,-,g | tr / _ | tr -d \'\"\?\[:cntrl:\]
}
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 :-)

The part of the script that steers this is the simple ${OUTPUT} part. Run the script and have a listen to all five formats: a fascinating exercise that invites some interesting comparisons! And perhaps I might suggest if you wish to use the "5 codecs" method that you both beef up the MAXPROCS option in your ~/.abcde.conf and also buy yourself a bigger HDD?

~/.abcde.conf for Speex

Speex is down the bottom here as it is designed for the spoken word, not music, but can I say that it does a fantastic job on such things as audio books and the like.

# -----------------$HOME/.abcde.conf----------------- #
# 
# A sample configuration file to convert music cds to 
#       Speex using abcde version 2.5.3
# 
#       http://andrews-corner.org/abcde.html
# -------------------------------------------------- #

# Specify the encoder to use for Speex. In this case
# speexenc is the only choice.
SPEEXENCODERSYNTAX=speexenc

# 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/speexenc
SPEEXENC=speexenc

# Specify your required encoding options here. Multiple options can
# be selected as '-q 6 --another-option' etc.
SPEEXENCOPTS='--denoise --quality 8 --vad --comp 5'  

# Output type for Speex
OUTPUTTYPE="spx"

# 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="$HOME/music/"               

# The default actions that abcde will take.
ACTIONS=cddb,playlist,read,encode,tag,move,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}/${TRACKNUM}.${TRACKFILE}'
VAOUTPUTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${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?
COMMENT="Encoded for Speex Playback"    # Comment meta tag
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 :-)

Speex implementation needs a little polishing in the bare source although patches exist to fix a few small problems. Hopefully some of these patches will be rolled into a new version of abcde one day?

And in conclusion...

Of all the pages that I have written for Linux this one has been the most fun. I guess because abcde is such a beautifully written script that invites you to explore programs that are all gems in their own right. Please feel free to use the email address at the base of this page to pass on your thoughts about this page, any corrections, praise or condemnation. And remember: Have fun!