CD Backup

Home CD Backup Transcoding


Using Foobar

By far the easiest way to transcode to individual track files is to use Foobar, with the Diskwriter component.

Diskwriter is included in the normal and special Foobar installers, but if you have opted for the lite installer you will need to download it and the CLI encoder. CLI stands for Command Line Interface. This Diskwriter component will allow you to use Diskwriter to call command line encoders, like MAC.EXE. This provides a huge level of flexibility - if Foobar can decode/play a file, and you have a command line encoder to encode to a particular format, you can transcode pretty much anything. If the encoder supports piping/STDIN input you can use that, otherwise Foobar will write to a temporary WAVE file first, and pass that to the encoder.

If you opted for the lite or normal versions you may want to check out the other Diskwriter components also available on Case's site, under "Diskwriter output". Both special installers include the option to install these already. These provide direct access to the relevant encoders, rather than having to set up a CLI profile. You will notice the Monkey's Audio encoder - this allows you to simply pick the compression level from a dropdown list, and that's as hard as it gets. Update: Case has removed his foobar2000 page, but you can still browse his diskwriter components. As well as foo_monkey (Monkey's Audio encoder), other notable Diskwriter components are foo_flaccer (FLAC encoder), foo_vorbisenc (Ogg Vorbis encoder), and foo_naac (Nero MP4 encoder). There may be others - take a looksee.

Beginning the Process

For this example I will use LAME - but any command line encoder, or specific Diskwriter component, can be used.

Setting up the Diskwriter component

From the menu select Foobar2000 > Preferences.

From the treeview in the left pane, select Diskwriter.

Foobar's Properties dialogue, showing the Diskwriter configuration

Output File Name Formatting

The first noteworthy area is the "Output file name formatting" textbox. This string will determine the path and filename of your transcoded files. If you check the "Create subdirectories" checkbox any slashes in the string will be interpreted as folder boundaries, enabling you to create folders in which to place the files.

The default string is as follows:

$num(%_diskwriter_index%,3) %_filename%

This is using Foobar's TAGZ scripting language to dynamically detirmine the name of each file created. A full description of TAGZ is outside the scope of this document. If you would like to create your own strings, which may become necessary to get the best out of Foobar, the first place to look is your Foobar install directory, at the file "titleformat_help.html". This HTML file gives a brief explanation of the syntax and functions available. You could also take a look at the Foobar2000 Formatting site, for numerous examples of formatting scripts for the playlist, title bar, etc.

The default string will name the files using the diskwriter index/queue number (%_diskwriter_index%), and the filename of the source file (%_filename%). I use the following string, with the "Create subdirectories" checkbox checked:

$if2(%artist%,'Unknown Artist')\$if2(%album%,)\$if(%tracknumber%,$num(%tracknumber%,2),$num(%_diskwriter_index%,3)) 
- $if2(%title%,%_filename%)

With a properly tagged file, this string will create a path like: <artist>\<album>\<tracknumber> - <title>.ext - e.g.: "Green Day\American Idiot\02 - Jesus of Suburbia.mp3". The resulting path will degrade gradually - so if no artist tag is present "Unknown Artist" will be used, and if no tags are present it will revert to the diskwriter index and filename (e.g.: "001 - CDImage.ape"). If you've followed the guide our APE files are tagged adequately.

If you are interested in creating your own string perhaps one place to start would be to decypher my string, using "titleformat_help.html" as a guide.

Output presets

By installing the CLI encoder component you will already have some presets included (NB: if you haven't installed it you will only have two presets in your dropdown list - both of which decode to WAVE). These presets may need some editing before you can use them, as they will all look for the relevant encoder in the Foobar folder, or a folder in your PATH system variable (i.e.: there is no path provided to the executable).

As an example, select the profile "Commandline Encoder: MPC --standard" from the dropdown list, and then click "Edit". You will notice in the subsequent dialogue that the encoder is referenced simply as "MPPENC.EXE". You may need to use the button to select the exact location of the encoder (for presets which you intend to use). By selecting to edit existing profiles you can learn a lot about creating your own in future.

Foobar's "Select file writer" dialogueClose the dialogue, and we'll create a profile of our own.

Click the "Add new" button below the "Output presets" dropdown. A small dialogue will appear (image, right), asking you to select what type of diskwriter component to use. Select "Comandline Encoder" from the list. You will now be presented with a dialogue to create your new command line encoder profile.

Foobar's "Commandline Encoder Settings" dialogue

The full string for the "Parameters" textbox is as follows:

-V5 --athaa-sensitivity 1 --tn "%tracknumber%" --tt "%title%" --ta "%artist%"
 --tl "%album%" --ty "%date%" --tc "-V5 --athaa-sensitivity 1" - %d

This is the command line I use to encode my MP3s at this time (using LAME 3.96.1). As you can see I am using the VBR preset "-V5" with the added parameter "--athaa-sensitivity 1". This is following discussion at Hydrogen Audio regarding an the best option for ~128kbps VBR using LAME 3.96.1 (the current stable release). This setting was used in Roberto Amorim's Multiformat at 128kbps Public Listening Test. ~128kbps is fine for me, as I listen to most of my MP3s in the car, where there is much background noise. In reality it is fine for me at home also, as I have two young children (providing increased background noise).

You will also notice that I am using LAME to tag the files. With these settings LAME will use ID3v1 where possible, but if the value is too large it will resort to ID3v2. My car stereo reads ID3v1. If you want Foobar to tags your files using an appropriate tag scheme use the "Tag" dropdown to select the scheme (rather than "none" as I have).

If you already have a preferred LAME command line then you simply need to bear in mind the " - %d" at the end, which is setting the input as a pipe (STDIN), and the output as the Foobar variable "%d", which will be detirmed by our "Output file name formatting string" as discussed above. If you aren't familiar with creating a LAME command lines then you could try those recommended at Hydrogen Audio.

The "Display name" is simply the name under which the preset will be listed in the Diskwriter configuration screen.

Beginning the Transcoding

Drag the APE file into the playlist. You can drag mutiple files into the same playlist if you want - if you have set up Diskwriter with a string the same, or similar to, mine the files will be stored in directories according to the ARTIST and ALBUM tags, and not lumped together in one directory.

Select the items in the playlist that you want to transcode.

Right-click, and select Convert > Run conversion from the context menu.

I have both "Always ask before writing" (Output directory) and "Ask before writing" (Output presets) checked in the Diskwriter configuration screen. If you have also, once you have selected Convert > Run conversion the "Select file writer preset" dialogue will appear, asking you to select the preset to use from a dropdown list. Following this, you will be presented with a directory browser and asked to select the root folder for the files. If you are creating folders with your "Output file name formatting" string they will be created in the folder you choose.

If you do not have "Always ask before writing" (Output directory) checked the folder specified in the configuration page will be used, or the input directory, depending whether you have "Same as source file directory" checked, and you will not be asked to specify a folder after you have selected Convert > Run conversion.

If you do not have "Ask before writing" (Output presets) checked the preset currently selected in the configuration page will be used, and you will not be asked to select a preset after you have selected Convert > Run conversion.

Using MAREO to Encode to Multiple Formats in One Run

MAREO is a command line application originally developed to be used with Exact Audio Copy. It acts as an intermediary between the source application (Exact Audio Copy or Foobar) and the encoder. MAREO allows you to begin one encoding run, and encode to multiple formats (sequentially) at the same time.

Since version 2.0.3, MAREO supports Diskwriter input. Essentially, you point Diskwriter at MAREO (rather than an encoder), and then edit your MAREO INI file to specify what formats you wish to encode to. You can also use this process to run pre-/post-processors, such as WaveGain, MP3Gain, or Wapet.

Using ACDIR on the Command Line

ACDIR is a console application that can split WAVE, Monkey's Audio, FLAC and WavPack files using a cuesheet. ACDIR can read embedded cuesheets in APE, WV and FLAC (VORBIS tag) files, or use an external cuesheet.

You can extract to track WAVE files, to be used with another application, or pipe the audio data directly to another console application (e.g.: LAME).

You can reference meta data within the cuesheet (TITLE, PERFORMER, and REM values) to create paths, set tag values, or some other purpose.

You can even process all, or just some, of the tracks.

At the time of writing the current version is 0.11 alpha, but development is rapid.

An Example Command Line

ACDIR.EXE --output "F:\$~A\$~T\$n - $~t.mp3" --pipe "LAME.EXE -V5 --tt $#t
  --ta $#a --tl $#T --tn $n - $#o" "E:\CDBackUp\Green Day\American Idiot\CDImage.ape"

The command line above (which is all one line) will use the embedded cuesheet in "E:\CDBackUp\Green Day\American Idiot\CDImage.ape" to reference the file "E:\CDBackUp\Green Day\American Idiot\CDImage.ape" and pipe each track separately to LAME. It will use cuesheet meta data to set ID3 tags, and create the files in an "<artist>\<album>\<tracknumber> - <title>.mp3" format on the F: drive (which is where I store all my MP3s).

Instead of passing the APE file in the command line (and therefore referring to the embedded cuesheet) I could have passed the external cuesheet to be used, e.g.:

ACDIR.EXE --output "F:\$~A\$~T\$n - $~t.mp3" --pipe "LAME.EXE -V5 --tt $#t
  --ta $#a --tl $#T --tn $n - $#o" "E:\CDBackUp\Green Day\American Idiot\CDImage.ape.cue"

... and ACDIR would refer to the cuesheet's FILE command to detirmine the APE file to use.

The Command Line Explained
--output "F:\$~A\$~T\$n - $~t.mp3"

The --output switch tells ACDIR how to format the track file paths.

ACDIR uses variables (e.g.: $A refers to the album artist) to refer to cuesheet meta data. By using $~A instead of $A the value will have any illegal filename characters replaced with a space.

Therefore, the value above tells ACDIR that I wish my track files to have the format "<artist>\<album>\<tracknumber> - <title>.mp3" - and to ensure that the artist, album and title values have illegal characters replaced with spaces. ACDIR will create folders if they don't already exist.

--pipe "LAME.EXE -V5 --tt $#t --ta $#a --tl $#T --tn $n - $#o"

The --pipe switch tells ACDIR that we want to pipe the audio data directly to an application, and to use the command that follows.

As $~A takes the artist value and replaces illegal character, $#A takes the artist value and surrounds it in quotes. This should generally be used when setting tag values.

So, the value above calls LAME, setting the title (--tt $#t), artist (--ta $#a), album (--tl $#T), and track number (--tn $n) ID3 tags. It specifies that the input will be piped (STDIN) by using "-" as the input value (this is the standard format for specifing STDIN or STDOUT when setting input or output values on console applications). Finally, the variable $#o represents the evaluation of the value specified using our --output switch, surrounded by quotes ($o > $#o).

Therefore, if the track being processed is track two of Green Day's album "American Idiot", the resulting LAME command will be:

LAME.EXE -V5 --tt "Jesus of Suburbia" --ta "Green Day" --tl "American Idiot"
  --tn "02" - "F:\Green Day\American Idiot\02 - Jesus of Suburbia.mp3"

Further Information

Although it may look complicated, it really isn't difficult to create an ACDIR command line to transcode your image APE file into track files, using any number of encoders.


The following table lists the variables which are most commonly used:

Variable Foobar Equivalent Cuesheet Command Description
$T %album% TITLE The name of the album
$A %album artist% PERFORMER The album artist
$n %tracknumber% TRACK The track number, zero-padded
$t %title% TITLE (within TRACK command) The title of the track
$a %artist% PERFORMER (within TRACK command) The track artist
$R{DATE} %date% REM DATE The album year (see Using $R{NAME} and $r{NAME}...)
$R{GENRE} %genre% REM GENRE The album genre (see Using $R{NAME} and $r{NAME}...)

NB: There are various other variables available, all of which can be listed using the following command:

ACDIR.EXE --help-variables

Variables can either be prefixed with a percent sign (%) or a dollar sign ($). I would always use the dollar sign, to ensure that your command can be used both at the command line, and within a batch file (the % will confuse matters within a batch file).

Use the tilde (~) in any path expression to specify that all illegal characters should be removed - so $T becomes $~T, $A becomes $~A, $t becomes $~t, and $a becomes $~a. ($n should have no illegal characters!).

Use the hash (#) to surround a value with quotes - so $T becomes $#T, $A becomes $#A, $t becomes $#t, $a becomes $#a, and $o becomes $#o. This is required within the --pipe switch as the --pipe command itself will be surrounded by quotes.

The --track Option

If you only want to transcode a range of tracks use the --track switch, e.g.:

ACDIR.EXE --output "F:\$~A\$~T\$n - $~t.mpc" --track 4-8 --pipe ...

... will only transcode tracks four through to eight.

The --extract Command

If you want to split to WAVE files, rather than pipe to an encoder (or other application), use the --extract switch:

ACDIR.EXE --output "F:\$~A\$~T\$n - $~t.wav" --extract CDImage.ape

The above command line will use the cuesheet embedded in "CDImage.ape" to extract to WAVE files using an "<artist>\<album>\<tracknumber> - <title>.wav" format.

The --echo Command

If you replace --pipe with --echo in your command line ACDIR will simply return the command that will be run for each track, without actually attempting to execute it.

This can be useful to test a new command line before you run it. E.g.:

ACDIR.EXE --output "F:\$~A\$~T\$n - $~t.mp3" --echo "LAME.EXE -V5 --tt $#t
  --ta $#a --tl $#T --tn $n - $#o" "E:\CDBackUp\Green Day\American Idiot\CDImage.ape"
The --hidden-track1 Command

If the CD that you ripped your image file from had a hidden track at INDEX 0 of TRACK 1 you can prepend that audio data to the beginning of track one by using the --hidden-track1 switch, e.g.:

ACDIR.EXE --output "F:\$~A\$~T\$n - $~t.mp3" --hidden-track1 --pipe ...
Using $R{NAME} and $r{NAME} to Access REM Text as Tag Values

ACDIR will let you access values stored in REM commands in the cuesheet.

Many people store additional meta data in cuesheets using the format:


NB: Tag names and values with spaces will need to be surrounded by quotes. If a tag value is not surrounded by quotes only the first word will be retrieved.

Some examples:

Command Tag Name Tag Value
REM COMMENT "This is a comment with spaces" COMMENT This is a comment with spaces
REM "FURTHER INFO" "This is a tag value with spaces" FURTHER INFO This is a tag value with spaces
REM COMMENT This is an invalid tag value COMMENT This
REM MY COMMENT Ouch, nasty, nasty command MY COMMENT

NB: Note the results produced by the last two comamnds due to the lack of quotes.

Tag names are case sensitive, so using $R{DATE} or $r{DATE} will only find "REM DATE" commands, and not "REM Date", "REM date" - or even "rem DATE" (all REM commands must be in uppercase). Obviously $R{Date} will find "REM Date", but not "REM DATE", etc.

Update: 0.11 alpha has been released, and has resolved all case-sensitivity issues. So, so $R{DATE} will find "REM DATE", "REM Date", "REM date", and "rem DATE". This is very welcome news.

An example:


To retrieve that value you would either use $R{DATE}, or $r{DATE}. ACDIR will then use the text following the command "REM DATE" as the variable value. As with the other variables, the capital letter suggests a top level (album) variable, and the lower case letter a track level variable. So, $R{DATE} will only look for the command at top level, but $r{DATE} will attempt to extract the value at track level, but revert to top level if none is found.

Consider the cuesheet extract below:

TITLE "American Idiot"
REM COMMENT "This is a top level comment"
FILE "CDImage.ape" WAVE
    REM COMMENT "This is a track level comment"
    TITLE "American Idiot"
    PERFORMER "Green Day"
    INDEX 01 00:00:00

If you use $R{COMMENT} in your command line the value will always be "This is a top level comment".

Assuming there are no other track level "REM COMMENT" commands, if you use $r{COMMENT} track one will have the value "This is a track level comment", while all other tracks will revert to the top level value, "This is a top level comment".

Update: As of version 0.95 Beta 1, Exact Audio Copy now automatically includes GENRE, DATE, DISCID, and COMMENT REM statements in the cuesheet it generates.


REM COMMENT ExactAudioCopy v0.95b1
PERFORMER "The Bravery"
TITLE "The Bravery"
FILE "CDImage.ape" WAVE
    TITLE "An Honest Mistake"
    PERFORMER "The Bravery"
    INDEX 01 00:00:00

This may be gutting for those people who have already archived hundreds of CDs and entered genre and date information manually, but it's good news for those of you just beginning the process.

Update: As of version 0.95 Beta 2, Exact Audio Copy now surrounds comment values with spaces with double quotes, which is a lot better for ACDIR. E.g.:

REM GENRE "Progressive Rock"
REM COMMENT "ExactAudioCopy v0.95b2"
PERFORMER "Pink Floyd"
TITLE "Pulse (CD 1)"
FILE "CDImage.ape" WAVE
    TITLE "Shine On You Crazy Diamond"
    PERFORMER "Pink Floyd"
    INDEX 01 00:00:00
Further Reading

Try one, or all, of the following at the command line:

ACDIR --help
ACDIR --help-options
ACDIR --help-commands
ACDIR --help-variables
ACDIR --h exec
ACDIR --h pipe
ACDIR --h echo
ACDIR --h extract
ACDIR --h find

Read the author's turorial.

Using Daemon Tools

If you decode your APE back to WAV and amend your cuesheet to point to the WAV file, you can mount your CUE to a virtual CD/DVD drive, using Daemon Tools. This will allow you to access the tracks as you would a normal CD - allowing you to encode the tracks using various means, inluding Exact Audio Copy. Daemon Tools cannot read a CUE/APE combination at this time.

This is more desirable to me than burning a CD, but does require a little manual/laborious work to get your new CUE and WAV file.

Burning to CD First

The most resource-heavy way to transcode is to burn your APE to CD first.

You will then have a physical CD to use with any ripper, including Exact Audio Copy, as you see fit.

What Now?

Read my accompanying guides:

The History

Thanks to Kevin Rebarchek for his questions via email, which prompted me to write this accompanying guide. It's pleasing to hear that someone has found my CD backup guide useful, and that they are actually thinking about the process as a whole. Please email me if you have found anything on this site useful.

Document Version History

Version Date Comment
1.1.6 2005-08-03 Updated link to the CLI Encoder, as Case has removed his foobar page.
1.1.5 2005-06-22 Updated Section on ACDIR to reflect changes made in 0.11 alpha.
1.1.4 2005-06-08 Added update regarding EAC v.0.95b2 and ACDIR v0.11 (superceded by changes made in 1.1.5).
1.1.3 2005-05-13 Added update regarding EAC v.0.95b1.
1.1.2 2005-05-10 Minor text changes.
1.1.1 2005-05-05 Added the section "Using $R{TAG NAME} and $r{TAG NAME} to Access REM Text as Tag Values".
1.1 2005-05-05 Added the section "Using ACDIR on the Command Line".
1.0 2005-03-08 Initial version.

Home | CueMake | Tag | Wapet | CD Backup | Email Me

This document has been printed from