Hi,
I wrote a simple perl wrapper script for hdcd.exe which passes the
inputstream unmodified if no HDCD is dectected. Otherwise, the
stream is decoded via hdcd.exe.
I call it via convert.conf as noted earlier in the thread:
flc flc transcode *
# FT:{START=--skip=%t}U:{END=--until=%v}D:{RESAMPLE=-r %d}
[flac] -dcs $START$ $END$ -- $FILE$ | perl c:\hdcdwrapper.pl | [sox]
-q -t wav - -t flac -C 0 $RESAMPLE$ -
Note that the script expects the hdcd.exe to be in a sub folder
as hard coded in the script.
I use mostly cue and flac files so this works great for me. I have
noticed
that this doesn't work well with HDCD and softsqueeze. I expect that
softsqueeze probably doesn't like the 24-bit files that this produces
when decoding HDCD tracks. I haven't tried it with squeezeplay yet.
You will need perl installed, I believe ( I use activestate ).
Any improvements, suggestions, bug fixes welcome...
I've tried this on a number of CDs and it seems to work, but I
make no guarantees.
George
Here is the script hdcdwrapper.pl:
-----------------------------
#
# Author: George Hines, [email protected]
#
# Note: because windows i/o redirection is brain dead, you must invoke
this
# script with perl command.pl. See:
#
http://community.activestate.com/faq/perl-redirect-problems-on-windows
#
use strict;
use diagnostics;
use warnings;
use File::Basename;
binmode (STDIN);
binmode (STDOUT);
my $basedir=dirname $0;
my $hdcd=$basedir . '\hdcd-convert\hdcd\hdcd.exe';
my $nframes = 750 + 1; # Add an extra frame to include the WAV header
my $framesize = 2352; # 2352bytes = 1/75th second @ 44.1khz 16bit
stereo
my $chunksize = $nframes * $framesize; # roughly 10 seconds...
my $buffer;
my $nbytes;
my $offset = 0;
my $count = $chunksize;
# Read enough to test for HDCD, may come in multiple reads
while ($count > 0 and ($nbytes = sysread (STDIN, $buffer, $count,
$offset)) > 0) {
$count -= $nbytes;
$offset += $nbytes;
}
$nbytes = $offset;
my $hdcd_detected = 0;
# launch pipe to check for HDCD stream
if (-x $hdcd) {
open (CMD, "| $hdcd -i 2>nul");
binmode (CMD);
syswrite (CMD, $buffer, $nbytes);
$hdcd_detected = close (CMD);
} else {
print STDERR "$0: can't find executable $hdcd\n";
}
if ($hdcd_detected) {
#print STDERR "$0: decoding HDCD\n";
#launch pipe to decode HDCD stream
# Note: the pipe (child process) will share and write to our
STDOUT
open (CMD, "| $hdcd 2>nul");
binmode (CMD);
} else {
#print STDERR "$0: no HDCD found, just copy input to output.\n";
*CMD = *STDOUT;
}
# write out entire input stream
do {
syswrite (CMD, $buffer, $nbytes);
} while (($nbytes = sysread (STDIN, $buffer, $chunksize)) > 0);
close (CMD);
exit (0);
-----------------------------
--
mrthreeplates
------------------------------------------------------------------------
mrthreeplates's Profile: http://forums.slimdevices.com/member.php?userid=565
View this thread: http://forums.slimdevices.com/showthread.php?t=57782
_______________________________________________
ripping mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/ripping