-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild_cg_world_voice
executable file
·143 lines (118 loc) · 5.6 KB
/
build_cg_world_voice
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/bin/sh
###########################################################################
## ##
## Language Technologies Institute ##
## Carnegie Mellon University ##
## Copyright (c) 2008-2012 ##
## All Rights Reserved. ##
## ##
## Permission is hereby granted, free of charge, to use and distribute ##
## this software and its documentation without restriction, including ##
## without limitation the rights to use, copy, modify, merge, publish, ##
## distribute, sublicense, and/or sell copies of this work, and to ##
## permit persons to whom this work is furnished to do so, subject to ##
## the following conditions: ##
## 1. The code must retain the above copyright notice, this list of ##
## conditions and the following disclaimer. ##
## 2. Any modifications must be clearly marked as such. ##
## 3. Original authors' names are not deleted. ##
## 4. The authors' names are not used to endorse or promote products ##
## derived from this software without specific prior written ##
## permission. ##
## ##
## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ##
## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ##
## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ##
## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ##
## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ##
## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ##
## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ##
## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ##
## THIS SOFTWARE. ##
## ##
###########################################################################
## Generic build all, clustergen voice script ##
###########################################################################
NAME=$1
PARALLEL=
PARALLEL=parallel
# Initial labeling
./bin/do_build $PARALLEL build_prompts
./bin/do_build label
# Remove all short silences <80ms (you can change that number in
# festvox/clustergen_build.scm in ClusterGen_ml_delete_short_pauses)
#./bin/do_clustergen remove_all_short_silences
./bin/do_clustergen $PARALLEL build_utts
# Build first generation of voice
# A slightly different set of duration features for flite (ok for festival)
#cp -p $FESTVOXDIR/src/clustergen/statedur.feats_flite festival/dur/etc/statedur.feats
./bin/do_clustergen generate_statenames
./bin/do_clustergen generate_filters
if [ "$SPTKDIR" = "" ]
then
# Old extraction tools not dependent on SPTK
./bin/do_clustergen $PARALLEL f0
./bin/do_clustergen $PARALLEL mcep
./bin/do_clustergen $PARALLEL voicing
else
# New extraction tools dependent on SPTK
./bin/do_clustergen $PARALLEL f0_v_sptk
# Because sometimes f0 extraction fails
mv etc/txt.done.data etc/txt.done.data.0
./bin/reduce_prompts etc/txt.done.data.0 f0/* >etc/txt.done.data
./bin/do_clustergen $PARALLEL mcep_sptk
fi
./bin/do_clustergen $PARALLEL combine_coeffs_v
# Because sometimes the feature extraction fails (not sure why)
# Lets be very careful here, and remove files that weren't processed well
for i in ccoefs/*.mcep
do
printf "$i "
$ESTDIR/bin/ch_track -info $i | grep "Number of channels:" | awk '{print $NF}'
done | awk '{if ($NF != 52) print $1}' >bad.files
cp -pr etc/txt.done.data etc/txt.done.data.precombine
cat bad.files |
while read x
do
fname=`basename $x .mcep`
grep -v "^( "$fname" " etc/txt.done.data >etc/txt.done.data.xxx
mv etc/txt.done.data.xxx etc/txt.done.data
done
# If there isn't a predefined train/test split, we'll make one
if [ ! -f etc/txt.done.data.test ]
then
./bin/traintest etc/txt.done.data
fi
./bin/do_clustergen $PARALLEL cluster etc/txt.done.data.train
./bin/do_clustergen dur etc/txt.done.data.train
# Test initial build to get basic stats
$FESTVOXDIR/src/clustergen/cg_test resynth cgp_base etc/txt.done.data.test >mcd-base.out
# For historical compatibility we'll copy the predicted cgp files
cp -plr test/cgp_base test/cgp
mv dur.dur.S25.out dur.dur.S25.out-base
# TTS for this model
$FESTVOXDIR/src/clustergen/cg_test tts tts_base etc/txt.done.data.test
exit
# Optimize number of states in hmms
./bin/do_clustergen nstates
# Optimize wagon stop values for mcep trees
./bin/do_clustergen wstop
# Do 10 iterations of move label to improve build
$FESTVOXDIR/src/clustergen/do_move_label $PARALLEL 20
# Select the best build
$FESTVOXDIR/src/clustergen/do_move_label select
# Rebuild with best labels
./bin/do_clustergen cluster etc/txt.done.data.train
./bin/do_clustergen dur etc/txt.done.data.train
mv dur.dur.S25.out dur.dur.S25.out-ml
# Final stats
$FESTVOXDIR/src/clustergen/cg_test resynth cgp_all >mcd-ml.out
exit
# Build a flite voice from this build
rm -rf flite
$FLITEDIR/tools/setup_flite
./bin/build_flite cg
cd flite
make
./flite_cmu_us_${NAME} "A whole joy was reaping, but they've gone south, go fetch azure mike." whole_${NAME}.wav
ls -altr flite_cmu_us_${NAME}