Configuration files for converting audio files
Simple Conversion
Learn how to convert your music files to Ogg Vorbis for casual use or to Flac for more refined playback.
MP3 is the most common audio format in computing. However, free software boasts two superior audio formats: Ogg Vorbis [1], a lossy format like MP3 but with better compression and sound quality, and Flac [2], a lossless high-quality format, whose files are usually several times larger that MP3 or Ogg Vorbis. Casual listeners might want to convert music files to Ogg Vorbis, while audiophiles might prefer Flac. Neither conversion is difficult, but both require some organization.
In both cases, the first difficulty of conversion is that it requires several dependencies. The overall process is run by abcde [3], a CD reader like cdparanoia [4] for ripping CDs, the oggenc codex [5] for Ogg Vorbis conversion, and the Flac codex for Flac conversion. Depending on your distribution, some of these dependencies may be installed by default, but you should check before attempting any conversion. You may also require an Internet connection.
All conversions are made with abcde. However, the second difficulty is that you will probably require a dozen or more options to make any conversion, opening countless opportunities for mistakes. Once you've done one conversion, the Bash history can speed the progress, but an even greater help is a custom /etc/abcde.conf
file that contains commonly used options, allowing you to concentrate only on unusual circumstances as you structure the command.
Abcde installs with its own /etc/abcde.conf
, but you should look over all its options, not just the ones for a particular conversion, and read the comments above each option. For convenience, you might even want to write custom abcde.conf
files for conversions to each format, using the -c FILE
option to point to the one you want to use. However, most settings are probably the same no matter what the conversion, so you can usually manage with a single file, with separate entries – one per line – for each conversion you do regularly. Some fields in configuration files you may choose to ignore as unimportant.
To avoid confusion, remember that manually entered options override all configuration files, custom configuration files override one in your home directory, and one in your home directory overrides the default one in /etc
. By editing the abcde configuration files carefully, you can greatly reduce the length of the command you need to enter, perhaps to something as basic as:
abcde -c /etc/abcde-ogg.conf DISK/FILEPATH
However, the options used in a conversion can be far more numerous. What follows are the configuration settings most likely to be useful. The purpose of the settings not mentioned here can usually be understood from the comments.
Important CDDB Options
An abcde configuration file falls into several categories (Figure 1). These are not named, but, if you choose, you might add a comment to identify them. Most of the fields in each category are commented out, so you will have to remove the hash sign at the start of a line if you want a field to activate.
At the top of the file is CDDB Options. The Compact Disc Database (CDDB) [6] is a database of published musical disks. The two most commonly used copies of the CDDB are CDDB or Musicbrainz, with CDDB set as the default in the CDDBMETHOD
field. Alternatively, by setting the CDDBUSELOCAL
field to y, you can use the database shipped with the CD instead. A third option is to set NOCDDBQUERY
to y, which will open a blank CDDB file for you to edit instead.
Should the CD's list of tracks differ from the one in CDDB, or if no entry for the CD exists, you have the option of specifying whether to send updates in CDDBSUBMIT
or of refusing to send updates by setting the NOSUBMIT=
field to n.
The CDDB section of the configuration file also sets the tags or metadata for each track, setting whether they include title, artist, composer, album artist, album, genre, year, and comments. These tags are used on some music players as different ways to list tracks, but if, for example, you never choose music by genre or year, you can omit these tags from the converted files by entering a comma-separated list of tags you do want in SHOWCDDBFIELDS
.
Codecs and Other Resources
The next section of an abcde configuration file defines the tools used for the conversion (Figure 2). The important of the fields in this section define the encoder to user. The field for Ogg Vorbis is OGGENCODERSYNTAX=
, and the one for Flac is FLACENCODERSYNTAX
. In most distributions, both can be set to default, which means that oggenc and Flac are used. However, you can also enter the path to any other application that will convert the file. Other formats have similar fields, such as MP3ENCODERSYNTAX=
for MP3 conversions. Give the location of the ripping program and pass any extra options.
Directly below this section, you can set the options for each encoder. This is probably the handiest part of the configuration file, because it allows you to enter the most common options once for all conversions to the format. Should you want the occasional different option, you can enter them manually when you type the command. It can be followed by OUTPUTTYPE=
, which takes any legitimate extension for an audio file, including .ogg and .flac.
For Ogg Vorbis conversions, you will need to add -q NUMBER
, with 1 being the lowest quality and 10 the highest. Another useful option is --resample NUMBER
, which sets the sampling rate. A sample rate of 44,100 is equivalent to a low-quality MP3, while 96,000 is equivalent to a high-quality MP3, although in both cases the Ogg Vorbis file should have high-quality sound. A sample rate of 192,000 is the highest sample rate that makes a difference in quality on most music players. You can add other options as seems appropriate.
For Flac, useful options include -0
to -8
to set the level of compression, with -8
being the highest, and -V
, which verifies all conversions. You can also use --picture=FILE SPECIFICATION
if you want to include album covers with a file. Flac does not have a man file – presumably because it is technically a codex, not a command – so instead refer to the help on the website.
Similarly, the CD reader to use is set in CDROMREADERSYNTAX
– usually to cdparanoia. Although other entries are also acceptable, some of them, like Flac, are specific to a format. If cdparanoia is chosen – and, generally, there is no reason why not – you can enter options in CDPARANOIAOPTS=
.
Output Options
The final section of a configuration file sets details about the output (Figure 3). Most likely, you will have no need to change:
ACTIONS=cddb,playlist,read,encode,tag,move,clean
However, you might want to use OUTPUTDIR
to specify the destination for converted files, instead of saving them to the current directory.
Another useful set of options sets how single and various single and multiple tracks are named with fields. Track names are built of building blocks, and you can choose which ones to include:
OUTPUTFORMAT='${OUTPUT}/${ARTISTFILE}-${ALBUMFILE}/${TRACKNUM}.${TRACKFILE}'VAOUTPUTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${TRACKNUM}.${ARTISTFILE}-${TRACKFILE}'
Because these are the names that will appear on music player lists, I recommend making them as short as possible so you do not have to endure endless horizontal scrolling and truncated listings. For consistency's sake, I also suggest using the same pattern for albums by both single and various artists. You can use the same naming conventions to create external playlists with .m3u
extensions.
At the very bottom of the installed configuration file is a script that removes illegal characters from names, including spaces. Other fields set niceness, or the relative share of system resources parts of the conversion process use, and the paths to scripts and applications, although neither should be necessary on modern systems.
It is followed by a collection of random options, such as PADTRACKS=y
, which tags track numbers using two digits instead of 1, and EJECTCD=y
, which completes conversions by ejecting CDs.
Buy this article as PDF
(incl. VAT)