diff options
| author | jules on spawn <spawn@cortex> | 2018-05-25 15:56:35 +0200 |
|---|---|---|
| committer | jules on spawn <spawn@cortex> | 2018-05-25 15:56:35 +0200 |
| commit | 1747f33c34e85fcbf161e4680404fdce2ee384f0 (patch) | |
| tree | 1c786a92b0788741ff9fc33a2b31325178bdb892 /datasets | |
| parent | e966dd1f6143d15cbfa0f92d4b414206dec90972 (diff) | |
if pitchshiftedfiles are not exactly 8 seconds remove them
Diffstat (limited to 'datasets')
| -rwxr-xr-x | datasets/dataset.pl | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/datasets/dataset.pl b/datasets/dataset.pl index cd068bf..568928c 100755 --- a/datasets/dataset.pl +++ b/datasets/dataset.pl @@ -3,8 +3,8 @@ use strict; use Getopt::Std; -our $opt_c; # normalize the file -our $opt_j; # jitter the pitch of each subsample by N rather than repitching big chunks +our $opt_c; # DON'T normalize the file +our $opt_j; # jitter the pitch of each subsample by N 1/100th semitones rather than repitching big chunks getopts('cj:'); print "<<<< DATASET >>>>\n"; @@ -78,9 +78,16 @@ sub process($) { next if /^\./; print "$i...\n" if ++$i % 100 == 0; my $fn = $_; - my $n = rand( 2 * $opt_j ) - $opt_j; - system 'sox', $name . '/' . $fn, $name . '/z_' . $fn, 'pitch', $n; - system 'rm', $name . '/' . $fn; + my $in_fn = $name . '/' . $fn; + my $out_fn = $name . '/z_' . $fn; + my $n = int rand( 2 * $opt_j ) - $opt_j; + system 'sox', $in_fn, $out_fn, 'pitch', $n; + my $rep = `soxi $name/z_$fn`; + if ($rep =~ /352800/) { + unlink $in_fn; + } else { + unlink $out_fn; + } } closedir $dh; } |
