forked from Snowdar/asv-subtools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakeFeatures.sh
executable file
·52 lines (40 loc) · 1.33 KB
/
makeFeatures.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
#!/bin/bash
# Copyright xmuspeech (Author:Snowdar 2018-7-25)
pitch=false
pitch_config=subtools/conf/pitch.conf
cmvn=false
use_gpu=false
nj=20 #num-jobs
exp=exp/features
. subtools/parse_options.sh
if [[ $# != 3 ]];then
echo "[exit] Num of parameters is not equal to 3"
echo "usage:$0 [--pitch false|true] [--pitch-config subtools/conf/pitch.conf] [--nj 20|int] <data-dir> <feature-type> <feature-config>"
echo "[note] Base <feature-type> could be fbank/mfcc/plp/spectrogram and the option --pitch defaults false"
exit 1
fi
data=$1
feat_type=$2
config=$3
suffix=
cuda=
[ "$use_gpu" == "true" ] && cuda=cuda
pitch_string=
if [ $pitch == "true" ];then
suffix=pitch
pitch_string="--pitch-config $pitch_config"
fi
case $feat_type in
mfcc) ;;
fbank) ;;
plp) ;;
spectrogram) ;;
*) echo "[exit] Invalid base feature type $feat_type ,just fbank/mfcc/plp" && exit 1;;
esac
name=`echo "$data" | sed 's/\// /g' | awk '{for(i=1;i<=NF-1;i++){printf $i"_";}printf $NF}'`
subtools/kaldi/steps/make_${feat_type}${suffix:+_$suffix}${cuda:+_$cuda}.sh $pitch_string --${feat_type}-config $config --nj $nj --cmd "run.pl" $data $exp/${feat_type}/$name/log $exp/${feat_type}/$name || exit 1
echo "Make features done."
if [ $cmvn == "true" ];then
subtools/kaldi/steps/compute_cmvn_stats.sh $data $exp/cmvn/log $exp/cmvn || exit 1
echo "Compute cmvn stats done."
fi