#!/usr/bin/perl # feeds all AUDIO tracks into sox. might work only # on little-endian machines, so BEWARE! $PLAY = "trap '' INT; play -traw -r44100 -c2 -sw - >/dev/null"; use Convert::CD::Track; use Convert::CD::Cue; $SIG{INT} = sub { $int++ }; print "interrupt to skip song\n"; for (@ARGV) { print "reading $_\n"; my $toc = new Convert::CD::Cue path => $_; my $cd = $toc->read; open PLAY, "|-", $PLAY or die "@PLAY: $!"; $| = 1; for my $track ($cd->track) { next unless $track->{mode} == MODE_AUDIO; print "playing ", $track->as_string, "\n"; my $size = $track->size; my $chunk = $track->{datasize}; for (my $ofs = 0; $ofs < $size && !$int; $ofs += $chunk) { my $data = $track->read ($ofs, $chunk); syswrite PLAY, $data; printf " %5.2f %s / %s\r", 100 * $ofs / $size, $track->to_msf ($ofs), $track->to_msf ($size); } $int = 0; } }