Wow, honorary asshole judge? Never thought I'd live to see the day.
For reward, can you hook up me with a PAX Prime Sunday badge? (I already have the other three.) Also, if you could shout out to your friends to see if anyone needs another hotel roommate, that'd be great. (I know pence and Ro are already full up.)
In case anyone cares, here's the script. It's very simple and not super efficient (string operations on raw bytes! keeping the entire wave in memory!), but it does work.
#!/usr/bin/env perl
use warnings; use strict;
use Audio::Wav;
die "missing file" unless @ARGV;
my $wav = new Audio::Wav; my $in = $wav->read($ARGV[0]); my $details = $in->details(); my $out = $wav->write("fixed-$ARGV[0]", { 'bits_sample' => $details->{bits_sample}, 'channels' => $details->{channels}, 'sample_rate' => $details->{sample_rate}, } ); print "input is ", $in->length_seconds(), "\n"; my $raw = $in->read_raw($details->{total_length}); print "length of raw is ", length($raw), "\n";
Wow, honorary asshole judge? Never thought I'd live to see the day.
For reward, can you hook up me with a PAX Prime Sunday badge? (I already have the other three.) Also, if you could shout out to your friends to see if anyone needs another hotel roommate, that'd be great. (I know pence and Ro are already full up.)
In case anyone cares, here's the script. It's very simple and not super efficient (string operations on raw bytes! keeping the entire wave in memory!), but it does work.
Dude you should have told me. I could have grabbed you one when they released more passes the other day. I grabbed one for my friend.
Comments
For reward, can you hook up me with a PAX Prime Sunday badge? (I already have the other three.) Also, if you could shout out to your friends to see if anyone needs another hotel roommate, that'd be great. (I know pence and Ro are already full up.)
In case anyone cares, here's the script. It's very simple and not super efficient (string operations on raw bytes! keeping the entire wave in memory!), but it does work.
#!/usr/bin/env perl
use warnings;
use strict;
use Audio::Wav;
die "missing file" unless @ARGV;
my $wav = new Audio::Wav;
my $in = $wav->read($ARGV[0]);
my $details = $in->details();
my $out = $wav->write("fixed-$ARGV[0]",
{
'bits_sample' => $details->{bits_sample},
'channels' => $details->{channels},
'sample_rate' => $details->{sample_rate},
}
);
print "input is ", $in->length_seconds(), "\n";
my $raw = $in->read_raw($details->{total_length});
print "length of raw is ", length($raw), "\n";
my %bad =
(
"\0\0\0" => 1,
"\1\0\0" => 1,
"\x{ff}\x{ff}\x{ff}" => 1,
);
# read triple.
# if bad, add to bad buffer and increment bad count.
# if not bad, output bad buffer (unless its size is 71!) and this not bad triple.
my $badcount = 0;
my $badbuffer = '';
my $output = '';
for (my $i = 0; $i < length $raw; $i += 3) {
my $sample = substr $raw, $i, 3;
if($bad{$sample}) {
$badcount++;
$badbuffer .= $sample;
} else {
if($badcount == 71) {
print "*";
$output .= $sample;
$badcount = 0;
$badbuffer = '';
} else {
# spurious sample. dump badbuffer and it.
$output .= $badbuffer;
$output .= $sample;
$badcount = 0;
$badbuffer = '';
}
}
}
$out->write_raw($output);
edited file
scilab script