Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions egs/wsj/s5/utils/data/perturb_data_dir_volume.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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
Expand Down