On Tuesday 04 March 2008, Joseph Hall wrote:
> On Tue, Mar 4, 2008 at 3:59 PM, Nicholas Leippe <[EMAIL PROTECTED]> wrote:
> > I have my own custom script for ripping & encoding.
> >  I rip each cd twice, once each from two different drives, and compare
> > them. I have calculated the offsets of each drive and use the -O flag on
> > cdparanoia. Since I have two drives, and two cpus, I wrote it to do all
> > five tasks at once in a pipeline fashion--2 ripping, 1 diffing, and 2
> > encoding simultaneously.
>
> Wow. I am impressed, and intrigued. Combine with a robotic arm for a
> truly automated setup:
>
> http://blog.makezine.com/archive/2008/03/diy_cd_changer.html
>
> >  If you want to calculate your drive's offset, I'd be happy to tell you
> > how.
>
> Is it short enough to post here? I have a couple of newly-acquired
> drives that I acquired with ripping specifically in mind. They're both
> Plextor iirc, but I'm out of town until Friday night, so can't check
> model numbers until then.

The entire script is too long to post, but here's how you can determine the 
drive offset:

<paste>

##############################################################################
#
#  Notes on how to determine cdparanoia drive offset
#
##############################################################################

# see this chart:
# http://accuraterip.com/driveoffsets.htm
# it looks as if cdparanoia's offset is the accuraterip offset plus 6
# drive             cdparanioa offset  accuraterip offset
# -----             -----------------  ------------------
# Plextor  PX-40TW  +682               +676
# Yamaha   CRW-F1S  +739               +733
# Toshiba  SD-M1401 -466               -472
# TSSTcorp TS-H552B                    +12

#  since cdparanoia cannot do negative offsets, any drive with a negative
#  offset can't be helped. The cmp test below will reveal this below.

##############################################################################
#
#  First, create a raw file with 16-bit numbers from 0-65535, you can use
#  this C++ program to do so:
#
#
#

PROG=<<EOF
#include <fstream>
using namespace std;

int main(void) {
        ofstream out("seq.raw");
        for (int i = 0; i < 65536; i++) {
                unsigned short s = i;
                out.write(static_cast<const char*>((void*) &s), 2);
        }
        out.close();
        return 0;
}

EOF

#
#  It will create a file name seq.raw
#
#  Now, use sox to convert it to a 16-bit, stereo wav file suitable for
#  writing as an audio cd track:
#

# sox -r 44100 -c 2 -s -w -x seq.raw seq.wav

# -c 2 means treat as if it has two channels (stereo), otherwise it will
#      double it up on you
# -s means it's in signed linear format (we don't want it to change the bits
#    on us at all)
# -w means it is 16-bit
# -x tells it to byte-swap it (this is on Intel or other little-endian
#    hardware, on big-endian machines you will probably need to omit this
#    flag, or we could change the code above to use the network byte-swapping
#    functions instead)

#  Now, create an audio cd using this file as track 1
#  Next, rip it:

# cdparanoia -B -R -X -d /dev/cdrw 1-1

#  this will create a file track01.cdda.raw

#  Next, we need to figure out the offset, use xdelta, or cmp and visually 
inspect

#  With cmp:

# cmp -l seq.raw track01.cdda.raw

#  look for the offset of the first 1 in the left column (it should be 3)
#  look for the offset of the first 1 in the right column
#  (search with /1$), in my case it is 2959
#  subtract 3 from 2959, and I get 2956
#  because it is 16-bit, stereo, divide 2956 by 4, 2956/4 = 739, this is the 
offset

#  Now, test it, rip it again with the offset:

# cdparanoia -O 739 -B -R -X -d /dev/cdrw 1-1

# cmp -l seq.raw track01.cdda.raw

#  This time, cmp will either hit EOF on seq.raw (because the ripped track is
#  longer, with padded 0s at the end), or return empty (they're the same!)

#  With xdelta:
#
#  create an xdelta patch, with seq.raw first
#
# xdelta delta seq.raw track01.cdda.raw xdelta.patch
#
#  look at the stats on it:
#
# xdelta info xdelta.patch
#
#  will produce something like:

#xdelta: version 1.1.3 found patch version 1.1 in xdelta.patch (compressed)
#xdelta: output name:   track01.cdda.raw
#xdelta: output length: 131712
#xdelta: output md5:    59383ff251b94b5e054c344f4ab91cf1
#xdelta: patch from segments: 2
#xdelta: MD5                                     Length  Copies  Used    Seq?   
 
Name
#xdelta: 4479658d3c294d569a128a78515dc296        2956    1       2956    yes    
 
(patch data)
#xdelta: c497ed7bbeddaa1eaab90d35a25400b2        131072  1       128756  yes    
 
seq.raw

# notice that the first delta length and used are both 2956, the same as the
# raw offset from above. This is our number to divide by 4 and get the same 
739

# the second delta contains the trailing 0s, which we can ignore


</paste>

enjoy.

Nick


/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to