summaryrefslogtreecommitdiff
path: root/datasets
diff options
context:
space:
mode:
Diffstat (limited to 'datasets')
-rwxr-xr-xdatasets/dataset.pl17
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;
}