[Flac-users] CD -> FLAC -> CD

Curt Sampson cjs at cynic.net
Thu Aug 28 18:45:01 PDT 2003


On Thu, 28 Aug 2003, Dax Kelson wrote:

> I'm still looking for some front end scripts that will let me go:
> CD-->FLACs-->CD

I've attached my rip and encode scripts. I use cdrdao to rip. Making
a new CD is a fairly simple matter of just extracting the wav from the
flac file and giving that and the .toc file back to cdrdao to burn.

Note that these scripts are separate because you can rip a lot faster
than you can encode, but you can encode without being at the computer.
So when I was ripping my CD collection, I'd spend all day feeding in
CDs and building up a big backlog of raw PCM files, and then let the
computer catch up with the encoding overnight.

There are varous problems with things so far:

1. There's no way to put the .toc file into the FLAC file, so you have
to keep two files for every CD.

2. cdrdao doesn't read some CDs with "funny" tables of contents; it dies
with an assertion error. About forty of my eight hundred CDs are still
not encoded because of this, but the author has not been very responsive
to my bug reports about this.

3. This doesn't grab the data session on a multi-session CD, so you lose
the bonus computer stuff if the CD has that.

4. Outside of CD-TEXT, you lose any R through W subcode information.

Oh, note that I also grab the cddb ID in my rip script, and put that
into a separate file. In theory, it's possible to generate the cddb ID
from either the FLAC file or the TOC file, but I've not written anything
to do that yet. When I do, the existing .cddbid files I've created will
let me test it.

cjs
-- 
Curt Sampson  <cjs at cynic.net>   +81 90 7737 2974   http://www.NetBSD.org
    Don't you know, in this new Dark Age, we're all light.  --XTC
-------------- next part --------------
#!/bin/sh
#
#  Extract audio data, TOC and cddb discid from the CD in the drive.
#

DEVICE=/dev/rcd0d

set -e

if [ -z "$1" ]; then
    echo "Usage: $0 <artist-album-filename>"
    exit 2
fi

cd-discid $DEVICE > "$1".discid
cdrdao read-cd --device $DEVICE --driver generic-mmc \
    --eject --datafile "$1".pcm "$1".toc
eject cdrom
echo "T160>CDE" > /dev/speaker
-------------- next part --------------
#!/bin/sh
#
#  Extract audio data, TOC and cddb discid from the CD in the drive, and compress
#  the audio data into FLAC format.
#

DEVICE=/dev/rcd0d

set -e

if [ -z "$1" ]; then
    pcmlist=$(eval echo *.pcm)
else
    pcmlist="$@";
fi

if [ "$pcmlist" = "*.pcm" ]; then
    echo No files to encode.
    exit 0
fi

for pcm in $pcmlist; do
    base=$(basename $pcm .pcm)
    if [ -e $base.toc -a ! -e "$base".flac ]; then
	toc2cue "$base".toc "$base".cue 2>/dev/null
	nice -20 flac -V --best \
	    --delete-input-file \
	    --endian=big --sign=signed --channels=2 --bps=16 \
	    --sample-rate=44100 \
	    --cuesheet="$base".cue "$base".pcm
	rm "$base".cue
    fi
done


More information about the Flac mailing list