From 952ebcb263f3cc75554da0e8b91f8a74be5786e2 Mon Sep 17 00:00:00 2001 From: Nikhil M Date: Sun, 10 Mar 2019 10:53:17 +0530 Subject: [PATCH] Update perturb_data_dir_volume.sh --- .../s5/utils/data/perturb_data_dir_volume.sh | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/egs/wsj/s5/utils/data/perturb_data_dir_volume.sh b/egs/wsj/s5/utils/data/perturb_data_dir_volume.sh index dae440b03a3..f3227d1cc54 100755 --- a/egs/wsj/s5/utils/data/perturb_data_dir_volume.sh +++ b/egs/wsj/s5/utils/data/perturb_data_dir_volume.sh @@ -43,6 +43,26 @@ fi # foo-1 cat foo.wav | sox --vol 1.6 -t wav - -t wav - | # volume perturbation done # bar-1 sox --vol 1.2 bar.wav -t wav - | # volume perturbation done # foo-2 wav-reverberate --additive-signals="sox --vol=0.1 noise1.wav -t wav -|" foo.wav | # volume perturbation not done +# volume_perturb_done=`head -n100 $data/wav.scp | python -c " +# import sys, re +# for line in sys.stdin.readlines(): +# if len(line.strip()) == 0: +# continue +# # Handle three cases of rxfilenames appropriately; 'input piped command', 'file offset' and 'filename' +# parts = line.strip().split() +# if line.strip()[-1] == '|': +# if re.search('sox --vol', ' '.join(parts[-11:])): +# print 'true' +# sys.exit(0) +# elif re.search(':[0-9]+$', line.strip()) is not None: +# continue +# else: +# if ' '.join(parts[1:3]) == 'sox --vol': +# print 'true' +# sys.exit(0) +# print 'false' +# "` || exit 1 + volume_perturb_done=`head -n100 $data/wav.scp | python -c " import sys, re for line in sys.stdin.readlines(): @@ -52,17 +72,18 @@ for line in sys.stdin.readlines(): parts = line.strip().split() if line.strip()[-1] == '|': if re.search('sox --vol', ' '.join(parts[-11:])): - print 'true' + print("True") sys.exit(0) elif re.search(':[0-9]+$', line.strip()) is not None: continue else: if ' '.join(parts[1:3]) == 'sox --vol': - print 'true' + print("True") sys.exit(0) -print 'false' +print("False") "` || exit 1 +volume_perturb_done1=$volume_perturb_done | tr '[:upper:]' '[:lower:]' if $volume_perturb_done; then echo "$0: It looks like the data was already volume perturbed. Not doing anything." exit 0