summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjules on spawn <spawn@cortex>2018-04-09 00:13:27 +0200
committerjules on spawn <spawn@cortex>2018-04-09 00:13:27 +0200
commita7256287f599dbaaffb107df0b8b4ea4a2b1f2b1 (patch)
treed816afa913fb63dd688be4f833c638fc782632d1
parentea6e6ee1040fa85f743ab50b699fbeb04d9a0522 (diff)
dataset script
-rwxr-xr-xdatasets/dataset.pl67
-rwxr-xr-xdatasets/spread.sh8
-rw-r--r--run.sh (renamed from train_test_generate.sh)23
3 files changed, 84 insertions, 14 deletions
diff --git a/datasets/dataset.pl b/datasets/dataset.pl
new file mode 100755
index 0000000..4e3b9a9
--- /dev/null
+++ b/datasets/dataset.pl
@@ -0,0 +1,67 @@
+#!/usr/bin/perl
+
+use strict;
+use Getopt::Std;
+
+our $opt_c;
+getopts('c');
+
+my $fmt = <<FMT;
+Input File : '01_snapping_clean.wav'
+Channels : 1
+Sample Rate : 44100
+Precision : 16-bit
+Duration : 00:03:09.35 = 8350438 samples = 14201.4 CDDA sectors
+File Size : 16.7M
+Bit Rate : 706k
+Sample Encoding: 16-bit Signed Integer PCM
+FMT
+
+sub process($) {
+ my $filename = shift or die "Usage: $0 [...filenames]\n";
+ my ($name, $ext) = split(/\./, $filename, 2);
+
+ my $soxi = `soxi $filename`;
+ my @lines = split("\n", $soxi);
+
+ print $soxi;
+
+ my $seconds;
+ for my $line (@lines) {
+ if ($line =~ /Duration : (\d\d):(\d\d):(\d\d)\./) {
+ my $h = $1;
+ my $m = $2;
+ my $s = $3;
+ $seconds = (((($h * 60) + $m) * 60) + $s) + 0;
+ }
+ }
+
+ my $scale = sprintf("%.09f", 5e-7 * $seconds);
+
+ print "Seconds: $seconds\n";
+ print "Scale factor: $scale\n";
+ print "\n";
+
+ my $a_tmp = "a_" . $filename;
+ my $b_tmp = "b_" . $filename;
+ if ($opt_c) {
+ print "Normalizing...";
+ system("sox", "-v", 0.945, $filename, $a_tmp);
+ } else {
+ $a_tmp = $filename;
+ }
+ system("./spread.sh", $a_tmp, $b_tmp, 0.999, $scale, 1.001);
+ system("./split44k.sh", $b_tmp, 8, $name);
+ if ($opt_c) {
+ system("/bin/rm", $a_tmp);
+ }
+ system("/bin/rm", $b_tmp);
+}
+
+foreach my $file (@ARGV) {;
+ if ( -e $file ) {
+ process($file);
+ }
+}
+
+
diff --git a/datasets/spread.sh b/datasets/spread.sh
index bec1da3..60c3551 100755
--- a/datasets/spread.sh
+++ b/datasets/spread.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
if [ "$#" -ne 5 ]; then
echo "Usage: $0 <in.wav> <out.wav> <rate_min> <rate_step> <rate_max>"
@@ -11,15 +12,22 @@ STEP=$4
MAX=$5
ITER=0
+
while true; do
if (( $(echo "$RATE > $MAX" | bc -l) )); then
break
fi
let ITER+=1
RATE=`echo "$RATE+$STEP" | bc`
+ if ((ITER % 20 != 0)); then
+ echo "${ITER}... ${RATE}"
+ sleep 1
+ fi
sox $FN_IN "tmp_$ITER.wav" speed $RATE
done
+echo "made $ITER copies"
+
sox tmp_* $FN_OUT
rm tmp_*
diff --git a/train_test_generate.sh b/run.sh
index af4f1c7..3237eb1 100644
--- a/train_test_generate.sh
+++ b/run.sh
@@ -74,20 +74,15 @@ function fast () {
run $1 1 6 44100 10
}
-standard 44k_blblbl2
-standard 44k_faty-scrub2
-standard 44k_faty-vocal2
+quick 01_snapping_clean
+quick 01_snapping_compress
+quick 01_snapping_highpass
-quick 44k_siren
-quick 44k_whatifvocode
-quick 44k_jlin-faty
+quick 01_snapping_clean
+quick 01_snapping_compress
+quick 01_snapping_highpass
-fast 44k_lipnoise
-quick 44k_jlin-faty
-quick 44k_jlin-faty
-
-run 44k_dances 8 6 44100 5
-run 44k_jlin4 4 3 44100 10
-
-run 44k_sundae 4 3 44100 10
+quick 01_snapping_clean
+quick 01_snapping_compress
+quick 01_snapping_highpass