3 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 # Copyright 2006 Jonas Häggqvist, some parts Copyright 2004 Daniel Gudlat
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.
15 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 # KIND, either express or implied.
18 # Include voicecommon.sh from the same dir as this script
19 # Any settings from voicecommon can be overridden if added below the following
21 source `dirname $0`'/voicecommon.sh'
27 # These settings can be overridden by passing a file with definitions as
28 # the fourth parameter to this script
30 # which TTS engine to use. Available: festival, flite, espeak
32 # which encoder to use, available: lame, speex, vorbis (only lame will produce
33 # functional voice clips at this point)
35 # Where to save temporary files
43 $VOICEFONT "$LANG_FILE" "$TEMPDIR/" "./$RLANG.voice"
47 # XXX: might be unsafe depending on the value of TEMPDIR
48 rm -f "${TEMPDIR}"/LANG_
*
49 rm -f "${TEMPDIR}"/VOICE_
*
56 GENLANG
="$ROCKBOX_DIR"/tools
/genlang
57 ENGLISH
="$ROCKBOX_DIR"/apps
/lang
/english.lang
58 LANG_FILE
="$ROCKBOX_DIR"/apps
/lang
/$RLANG.lang
60 $GENLANG -e=$ENGLISH -o -t=$TARGET $LANG_FILE |
(
66 NUMBER
=`echo $line |cut -b 2-`
70 ID
=`echo $line |cut -b 5-`
74 STRING
=`echo $line |cut -b 8-`
76 # Now generate the file
77 voice
"$STRING" "$TEMPDIR/$ID".wav
78 encode
"$TEMPDIR/$ID".wav
"$TEMPDIR/$ID".mp3
87 echo "Usage: $0 rockboxdirectory language target [settingsfile]";
90 if [ ! -d "$1" ] ||
[ ! -f "$1/tools/genlang" ]; then
91 echo "Error: $1 is not a Rockbox directory"
94 if [ ! -f "$1/apps/lang/$2.lang" ]; then
95 echo "Error: $2 is not a valid language"
98 if [ ! -z "$4" ]; then
100 # Read settings from file
103 echo "Error: $4 does not exist"
107 # XXX: check for valid $TARGET?
110 VOICEFONT
=`dirname $0`/voicefont
111 if [ ! -x $VOICEFONT ]; then
112 echo "Error: $VOICEFONT does not exist or is not executable"
118 generateclips
"$1" "$2" "$3"