CD Extract Version 0.10 Copyright (C) 2002 by Kevin Atkinson (kevin at atkinson dhs org) CD Extract is a Perl script which helps to automate the process of intelligently extracting audio from a CD and then converting the tracks into either MP3 or Ogg Vorbis format. It is *not* designed to make the process a no-brainier, it is expected that the user is familiar with the unix command prompt. CD Extract has the rare featuring of being able to avoid recording the gap between songs with the track itself. Often this gap just contains silence, however sometimes it contains actual audio such as interludes. CD Extract will either extract the gap between songs and store it in a separate file or simply ignore it. Cddb lookups on the disk are also supported. Using CD Extract is a two step process, a prep and execute stage. The prep stage scans the disk for track information and optionally performs a cddb lookup. The output of a prep stage is a data file contaminating all the relevant information on the disk. The data file can easily be edited to fine tune track information. The data file is then used by the execute stage to output the commands to extract the data from the cd and convert it into either MP3 or Ogg Vorbis format. The output of the execute stage is a shell script to execute. REQUIREMENTS Perl, cdda2wav, cdparanoia, and lame or oggenc. PREP STAGE The prep stage uses cdda2wav to read the disk's table of contents for track information, perform a cbbd lookup, and scan the disk for index marks to identify the pregap regions. It will then output the results to stdout. The usage is: cdextract prep [options] Where the options are: no-cddb - Don't perform a cddb lookup device - Device to use cdda-ops - Additional options to pass to cdda2wav pregap - Output information on the pregap segments, by default they are ignored For example: cdextract prep device /dev/cdrom1 > data.inf Which will scan the cdrom in /dev/cdrom1 and output the results to data.inf. EDIT The output may then be edited to fine tune the disk information. However, since the resulting file is actual Perl code, be careful when you modify it. Unless you know what you are doing, only modify text between single quotes and escape all single quotes within the string with a backslash ie use \'. EXECUTE STAGE The next step is to output the shell script which will do the real work of extracting and encoding the tracks. Cdparanoia will be used to extract (rip) the tracks and either lame or oggenc will be used to encode them. The input is the data file from the previous stage and the output is a shell script to execute. The usage is: cdextract exec [options] Where the options are: device - Device to use no-pregap - Ignore any pregap sections in the input keep-wav - Keep the resulting wav files no-encode - Don't encode the resulting wav files, implies keep-wav no-rip - Don't extract the tracks, just encode them. Assumes the wav files are already created and implies keep-wav. rip-ops - Options to pass to cdparanoia encoder - Encoder to use, defaults to lame encoder-ops - Options to pass to the encoder, the default is '--id3v1-only --alt-preset cbr 128' for lame and '' for oggenc. template - See template section below style - See template section below For example: cdextract exec encoder-ops '--alt-preset 128' < data.inf > data.sh FILE TEMPLATE The options template and style can be used to control the naming of the resulting files after the data is extracted from the cdrom drive and/or encoded. The template parameter controls the actual structure of the resulting file name. For example "%title%" will simply name the files based on the title of the track, and "%track%-%title%" will name the file based on the track number and title. The allowed parameters are: %album%, %year%, %track%, %title%, %artist%, and %comment%. If non-alphanumeric charters are included with the parameter name (between the %) those characters will only be displayed if the value of the parameter is non-empty. For example "%artist-%%title%" will only display the dash after the artist title if the artist filed is non blank. That is if the Artist for the track was "Billy Bob" and the title was "What a Day" the template "%artist-%%title%" would become "billy_bob-what_a_day", but if the artist for the track was unknown it would simply become "what_a_day" instead of "-what_a_day". The default template is "%artist-%%title%" The style parameter controls how the track information is converted when forming the file name. The default style, "basic", will convert the string to all lowercase and replace spaces with underscores ('_'), remove punctuation characters, and replace all other non-alphanumeric characters with dashes ('-'). For example the title "A Dog's Life (Is A Boring One)" would be converted to "a_dogs_life-is_a_boaring_one". The "safe" style will convert the name so it is a valid Win32 file name, that is it will either remove or convert illegal characters. The "none" style will leave the name as is. FINAL STEP The final step is to execute the resulting shell script. For example: bash data.sh other shells may work but only bash has been tested. If you trust the output of the exec stage to do what you want you can skip this step by simply piping the output of the second stage through bash. For example cdextract exec ... | bash FINAL WORDS I wrote this program mostly because I wanted a way to separate the annoying interludes from the normal tracks from a CD I had. The first time I did it I spend about a half hour with a audio editor splitting the resulting wav before encoding them. I latter noticed that on my car's CD player the interludes were playing with negative time which told me that the start of the interludes were some how encoded on the CD. I then investigated how this was done and came up with this program. As far as I know this is the only program which will automatically separate the interludes for you. I decided that others may find this program useful so I spent the time writing documentation and making the script suitable for release. So, if you also find this program useful please let me know at kevin at atkinson dhs org. Thanks. COPYRIGHT CD Extract is Copyright (C) 2002 by Kevin Atkinson under the GNU GPL license version 2.0. You should have received a copy of the GPL license along with this program if you did not you can find it at http://www.gnu.org/.