forked from funcwj/setk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_wpe.sh
executable file
·62 lines (47 loc) · 1.8 KB
/
run_wpe.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env bash
# wujian@2019
set -eu
nj=20
cmd="run.pl"
iters=3
stft_conf=conf/wpe.conf
delay=3
taps=10
context=1
sr=16000
nara_wpe=false
echo "$0 $@"
function usage {
echo "Options:"
echo " --nj <nj> # number of jobs to run parallel, (default=$nj)"
echo " --cmd <run.pl|queue.pl> # how to run jobs, (default=$cmd)"
echo " --stft-conf <stft-conf> # stft configuration files, (default=$stft_conf)"
echo " --iters <iters> # number of iters to run GWPE, (default=$iters)"
echo " --delay <delay> # time delay in GWPE, (default=$delay)"
echo " --taps <taps> # number of taps in GWPE, (default=$taps)"
echo " --context <context> # left/right context used in PSD matrix estimation, (default=$context)"
echo " --sr <sr> # sample rate for source wave, (default=$sr)"
echo " --nara-wpe <true|false> # use nara-wpe or not, (default=$nara_wpe)"
}
. ./path.sh
. ./utils/parse_options.sh || exit 1
[ $# -ne 2 ] && echo "Script format error: $0 <wav-scp> <dst-dir>" && usage && exit 1
wav_scp=$1
dst_dir=$2
for x in $wav_scp $stft_conf; do [ ! -f $x ] && echo "$0: missing file: $x" && exit 1; done
dirname=$(basename $dst_dir)
exp_dir=./exp/wpe/$dirname && mkdir -p $exp_dir
stft_opts=$(cat $stft_conf | xargs)
split_wav_scp="" && for n in $(seq $nj); do split_wav_scp="$split_wav_scp $exp_dir/wav.$n.scp"; done
./utils/split_scp.pl $wav_scp $split_wav_scp
mkdir -p $dst_dir
$cmd JOB=1:$nj $exp_dir/log/run_wpe.JOB.log \
./scripts/sptk/apply_wpe.py \
$stft_opts --num-iters $iters \
--sample-rate $sr \
--nara-wpe $nara_wpe \
--context $context \
--taps $taps --delay $delay \
$exp_dir/wav.JOB.scp \
$dst_dir
echo "$0: Run wpe algorithm done"