diff options
author | Jonas Häggqvist <rasher@rasher.dk> | 2007-11-16 20:07:23 +0000 |
---|---|---|
committer | Jonas Häggqvist <rasher@rasher.dk> | 2007-11-16 20:07:23 +0000 |
commit | a16ad96b1b4ccdc86ccf4467c4b930c6582eca42 (patch) | |
tree | 86ea12541c8b08645e964421ec658eef4c4c6a64 /tools/voicecommon.sh | |
parent | 1b2561b0d9cdb37ac433e81f8a014a92d714b3e8 (diff) | |
download | rockbox-a16ad96b1b4ccdc86ccf4467c4b930c6582eca42.tar.gz rockbox-a16ad96b1b4ccdc86ccf4467c4b930c6582eca42.zip |
Remove deprecated shellscripts
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15647 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools/voicecommon.sh')
-rw-r--r-- | tools/voicecommon.sh | 301 |
1 files changed, 0 insertions, 301 deletions
diff --git a/tools/voicecommon.sh b/tools/voicecommon.sh deleted file mode 100644 index 458a7b2ec6..0000000000 --- a/tools/voicecommon.sh +++ /dev/null | |||
@@ -1,301 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | # __________ __ ___. | ||
3 | # Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | # \/ \/ \/ \/ \/ | ||
8 | # $Id$ | ||
9 | # | ||
10 | # Copyright (c) 2006 Jonas Häggqvist | ||
11 | # | ||
12 | # All files in this archive are subject to the GNU General Public License. | ||
13 | # See the file COPYING in the source tree root for full license agreement. | ||
14 | # | ||
15 | # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | # KIND, either express or implied. | ||
17 | # | ||
18 | # A selection of functions common to creating voicefiles for Rockbox. | ||
19 | # | ||
20 | # You may wish to change some of the settings below. | ||
21 | |||
22 | ##################### | ||
23 | # Program locations # | ||
24 | ##################### | ||
25 | |||
26 | # Leave any you're not using untouched, enter full path if the program is | ||
27 | # not found | ||
28 | |||
29 | # the festival main executable | ||
30 | FESTIVAL_BIN=festival | ||
31 | # the festival_client binary | ||
32 | FESTIVAL_CLIENT=festival_client | ||
33 | |||
34 | # The flite executable | ||
35 | FLITE_BIN=flite | ||
36 | |||
37 | # The eSpeak executable | ||
38 | ESPEAK_BIN=espeak | ||
39 | |||
40 | # The lame executable | ||
41 | LAME_BIN=lame | ||
42 | |||
43 | # The speexenc executable | ||
44 | SPEEX_BIN=speexenc | ||
45 | |||
46 | # The oggenc executable | ||
47 | VORBIS_BIN=oggenc | ||
48 | |||
49 | # Tools directory | ||
50 | TOOLSDIR=`dirname $0` | ||
51 | |||
52 | # The wavtrim executable | ||
53 | WAVTRIM=$TOOLSDIR/wavtrim | ||
54 | |||
55 | # The SAPI5 script directory | ||
56 | if [ -f "`which cygpath`" ]; then | ||
57 | SAPI5DIR=`cygpath $TOOLSDIR -a -w` | ||
58 | fi | ||
59 | |||
60 | ##################### | ||
61 | # Festival settings # | ||
62 | ##################### | ||
63 | |||
64 | # If you're not using festival, leave untouched | ||
65 | |||
66 | # whether to start the Festival server locally (Y/N) | ||
67 | FESTIVAL_START=Y | ||
68 | # the host of the Festival server | ||
69 | # this is set to localhost automatically when FESTIVAL_START is Y | ||
70 | FESTIVAL_HOST=localhost | ||
71 | # the port of the Festival server | ||
72 | FESTIVAL_PORT=1314 | ||
73 | # where to log the Festival client output | ||
74 | FESTIVAL_LOG=/dev/null | ||
75 | # other options to the festival server | ||
76 | FESTIVAL_OPTS="" | ||
77 | |||
78 | ################## | ||
79 | # Flite settings # | ||
80 | ################## | ||
81 | |||
82 | # If you're not using flite, leave untouched | ||
83 | FLITE_OPTS="" | ||
84 | |||
85 | ################### | ||
86 | # eSpeak settings # | ||
87 | ################### | ||
88 | |||
89 | # If you're not using eSpeak, leave untouched | ||
90 | ESPEAK_OPTS="" | ||
91 | |||
92 | #################### | ||
93 | # Wavtrim settings # | ||
94 | #################### | ||
95 | |||
96 | # The maximum sample value that will be treated as silence by the wavtrim tool. | ||
97 | # The value is expressed as an absolute 16 bit integer sample value (0 dB equals | ||
98 | # 32767). | ||
99 | # | ||
100 | # 500 is a good guess - at least for Festival | ||
101 | |||
102 | NOISEFLOOR='500' | ||
103 | |||
104 | ##################### | ||
105 | # Encoding settings # | ||
106 | ##################### | ||
107 | # where to log the encoder output | ||
108 | ENC_LOG=/dev/null | ||
109 | |||
110 | # Suggested: --vbr-new -t --nores -S | ||
111 | # VBR, independent frames, silent mode | ||
112 | LAME_OPTS="--vbr-new -t --nores -S" | ||
113 | |||
114 | # Suggested: | ||
115 | # XXX: suggest a default | ||
116 | SPEEX_OPTS="" | ||
117 | |||
118 | # Suggested: -q0 --downmix | ||
119 | # Low quality, mono | ||
120 | VORBIS_OPTS="-q0 --downmix" | ||
121 | |||
122 | ################### | ||
123 | # End of settings # | ||
124 | ################### | ||
125 | |||
126 | # Check if executables exist and perform any necessary initialisation | ||
127 | init_tts() { | ||
128 | case $TTS_ENGINE in | ||
129 | festival) | ||
130 | # Check for festival_client | ||
131 | if [ ! -f "`which $FESTIVAL_CLIENT`" ]; then | ||
132 | echo "Error: $FESTIVAL_CLIENT not found" | ||
133 | exit 4 | ||
134 | fi | ||
135 | |||
136 | # Check for, and start festival server if specified | ||
137 | if [ X$FESTIVAL_START = XY ]; then | ||
138 | if [ ! -f "`which $FESTIVAL_BIN`" ]; then | ||
139 | echo "Error: $FESTIVAL_BIN not found" | ||
140 | exit 3 | ||
141 | fi | ||
142 | FESTIVAL_HOST='localhost' | ||
143 | $FESTIVAL_BIN $FESTIVAL_OPTS --server 2>&1 > /dev/null & | ||
144 | FESTIVAL_SERVER_PID=$! | ||
145 | sleep 3 | ||
146 | if [ `ps | grep -c "^\ *$FESTIVAL_SERVER_PID"` -ne 1 ]; then | ||
147 | echo "Error: Festival not started" | ||
148 | exit 9 | ||
149 | fi | ||
150 | fi | ||
151 | # Test connection to festival server | ||
152 | output=`echo -E "Rockbox" | $FESTIVAL_CLIENT --server \ | ||
153 | $FESTIVAL_HOST --otype riff --ttw --output \ | ||
154 | /dev/null 2>&1` | ||
155 | if [ $? -ne 0 ]; then | ||
156 | echo "Error: Couldn't connect to festival server at" \ | ||
157 | "$FESTIVAL_HOST ($output)" | ||
158 | exit 8 | ||
159 | fi | ||
160 | ;; | ||
161 | flite) | ||
162 | # Check for flite | ||
163 | if [ ! -f "`which $FLITE_BIN`" ]; then | ||
164 | echo "Error: $FLITE_BIN not found" | ||
165 | exit 5 | ||
166 | fi | ||
167 | ;; | ||
168 | espeak) | ||
169 | # Check for espeak | ||
170 | if [ ! -f "`which $ESPEAK_BIN`" ]; then | ||
171 | echo "Error: $ESPEAK_BIN not found" | ||
172 | exit 5 | ||
173 | fi | ||
174 | ;; | ||
175 | sapi5) | ||
176 | # Check for SAPI5 | ||
177 | cscript /B $SAPI5DIR/sapi5_init_tts.vbs | ||
178 | if [ $? -ne 0 ]; then | ||
179 | echo "Error: SAPI 5 not available" | ||
180 | exit 5 | ||
181 | fi | ||
182 | ;; | ||
183 | *) | ||
184 | echo "Error: no valid TTS engine selected: $TTS_ENGINE" | ||
185 | exit 2 | ||
186 | ;; | ||
187 | esac | ||
188 | if [ ! -x $WAVTRIM ]; then | ||
189 | echo "Error: $WAVTRIM is not available" | ||
190 | exit 11 | ||
191 | fi | ||
192 | } | ||
193 | |||
194 | # Perform any necessary shutdown for TTS engine | ||
195 | stop_tts() { | ||
196 | case $TTS_ENGINE in | ||
197 | festival) | ||
198 | if [ X$FESTIVAL_START = XY ]; then | ||
199 | # XXX: This is probably possible to do using festival_client | ||
200 | kill $FESTIVAL_SERVER_PID > /dev/null 2>&1 | ||
201 | fi | ||
202 | ;; | ||
203 | esac | ||
204 | } | ||
205 | |||
206 | # Check if executables exist and perform any necessary initialisation | ||
207 | init_encoder() { | ||
208 | case $ENCODER in | ||
209 | lame) | ||
210 | # Check for lame binary | ||
211 | if [ ! -f "`which $LAME_BIN`" ]; then | ||
212 | echo "Error: $LAME_BIN not found" | ||
213 | exit 6 | ||
214 | fi | ||
215 | ;; | ||
216 | speex) | ||
217 | # Check for speexenc binary | ||
218 | if [ ! -f "`which $SPEEX_BIN`" ]; then | ||
219 | echo "Error: $SPEEX_BIN not found" | ||
220 | exit 7 | ||
221 | fi | ||
222 | ;; | ||
223 | vorbis) | ||
224 | # Check for vorbis encoder binary | ||
225 | if [ ! -f "`which $VORBIS_BIN`" ]; then | ||
226 | echo "Error: $VORBIS_BIN not found" | ||
227 | exit 10 | ||
228 | fi | ||
229 | ;; | ||
230 | *) | ||
231 | echo "Error: no valid encoder selected: $ENCODER" | ||
232 | exit 1 | ||
233 | ;; | ||
234 | esac | ||
235 | |||
236 | } | ||
237 | |||
238 | # Encode file $1 with ENCODER and save the result in $2, delete $1 if specified | ||
239 | encode() { | ||
240 | INPUT=$1 | ||
241 | OUTPUT=$2 | ||
242 | |||
243 | if [ ! -f "$INPUT" ]; then | ||
244 | echo "Warning: missing input file: \"$INPUT\"" | ||
245 | else | ||
246 | echo "Action: Encode $OUTPUT with $ENCODER" | ||
247 | case $ENCODER in | ||
248 | lame) | ||
249 | $LAME_BIN $LAME_OPTS "$WAV_FILE" "$OUTPUT" >>$ENC_LOG 2>&1 | ||
250 | ;; | ||
251 | speex) | ||
252 | $SPEEX_BIN $SPEEX_OPTS "$WAV_FILE" "$OUTPUT" >>$ENC_LOG 2>&1 | ||
253 | ;; | ||
254 | vorbis) | ||
255 | $VORBIS_BIN $VORBIS_OPTS "$WAV_FILE" -o "$OUTPUT" >>$ENC_LOG 2>&1 | ||
256 | esac | ||
257 | if [ ! -f "$OUTPUT" ]; then | ||
258 | echo "Warning: missing output file \"$OUTPUT\"" | ||
259 | fi | ||
260 | fi | ||
261 | } | ||
262 | |||
263 | # Generate file $2 containing $1 spoken by TTS_ENGINE, trim silence | ||
264 | voice() { | ||
265 | TO_SPEAK=$1 | ||
266 | WAV_FILE=$2 | ||
267 | if [ ! -f "$WAV_FILE" ] || [ X$OVERWRITE_WAV = XY ]; then | ||
268 | if [ "${TO_SPEAK}" = "" ]; then | ||
269 | touch "$WAV_FILE" | ||
270 | else | ||
271 | case $TTS_ENGINE in | ||
272 | festival) | ||
273 | echo "Action: Generate $WAV_FILE with festival" | ||
274 | echo -E "$TO_SPEAK" | $FESTIVAL_CLIENT \ | ||
275 | --server $FESTIVAL_HOST \ | ||
276 | --otype riff --ttw --output "$WAV_FILE" 2>"$WAV_FILE" | ||
277 | ;; | ||
278 | espeak) | ||
279 | echo "Action: Generate $WAV_FILE with eSpeak" | ||
280 | echo $ESPEAK_BIN $ESPEAK_OPTS -w "$WAV_FILE" | ||
281 | echo -E "$TO_SPEAK" | $ESPEAK_BIN $ESPEAK_OPTS -w "$WAV_FILE" | ||
282 | ;; | ||
283 | flite) | ||
284 | echo "Action: Generate $WAV_FILE with flite" | ||
285 | echo -E "$TO_SPEAK" | $FLITE_BIN $FLITE_OPTS -o "$WAV_FILE" | ||
286 | ;; | ||
287 | sapi5) | ||
288 | cscript /B "$SAPI5DIR\sapi5_voice.vbs" ""$TO_SPEAK"" "$WAV_FILE" | ||
289 | ;; | ||
290 | esac | ||
291 | fi | ||
292 | fi | ||
293 | trim "$WAV_FILE" | ||
294 | } | ||
295 | |||
296 | # Trim wavefile $1 | ||
297 | trim() { | ||
298 | WAVEFILE="$1" | ||
299 | echo "Action: Trim $WAV_FILE" | ||
300 | $WAVTRIM "$WAVEFILE" $NOISEFLOOR | ||
301 | } | ||