mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 05:05:20 -05:00
Voice related changes:
- It's now possible to select multiple languages to build - Added encoder and TTS engine configuration to configure (per-language) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14309 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
414ee9fcc5
commit
58537b43e6
3 changed files with 94 additions and 58 deletions
123
tools/configure
vendored
123
tools/configure
vendored
|
|
@ -284,8 +284,25 @@ whichadvanced () {
|
|||
echo "done"
|
||||
|
||||
if [ "yes" = "$voice" ]; then
|
||||
voiceconfig
|
||||
toolset="${toolset} voicefont wavtrim"
|
||||
toolset="${toolset} voicefont wavtrim"
|
||||
|
||||
# Ask about languages to build
|
||||
echo "Select a number for the language to use (default is english)"
|
||||
echo "You may enter a comma-separated list of languages to build"
|
||||
|
||||
picklang
|
||||
voicelanguage=`whichlang`
|
||||
|
||||
if [ -z "$voicelanguage" ]; then
|
||||
# pick a default
|
||||
voicelanguage="english"
|
||||
fi
|
||||
echo "Voice language set to $voicelanguage"
|
||||
|
||||
# Configure encoder and TTS engine for each language
|
||||
for thislang in `echo $voicelanguage | sed 's/,/ /g'`; do
|
||||
voiceconfig "$thislang"
|
||||
done
|
||||
fi
|
||||
if [ "yes" = "$use_debug" ]; then
|
||||
debug="-DDEBUG"
|
||||
|
|
@ -304,8 +321,10 @@ whichadvanced () {
|
|||
fi
|
||||
}
|
||||
|
||||
# Configure voice settings
|
||||
voiceconfig () {
|
||||
echo "Building voice for $archos"
|
||||
thislang=$1
|
||||
echo "Building $thislang voice for $archos. Select options"
|
||||
echo ""
|
||||
|
||||
if [ "`which flite`" != "" ]; then
|
||||
|
|
@ -377,6 +396,13 @@ voiceconfig () {
|
|||
esac
|
||||
echo "Using $TTS_ENGINE for TTS"
|
||||
|
||||
# Allow the user to input manual commandline options
|
||||
printf "Enter $TTS_ENGINE options (enter for defaults `echo $TTS_OPTS |sed 's/.*=//'`): "
|
||||
USER_TTS_OPTS=`input`
|
||||
if [ -n "$USER_TTS_OPTS" ]; then
|
||||
TTS_OPTS="`echo $TTS_OPTS | sed 's/=.*//'`=\"$USER_TTS_OPTS\""
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
if [ "`which oggenc`" != "" ]; then
|
||||
|
|
@ -402,37 +428,46 @@ voiceconfig () {
|
|||
fi
|
||||
|
||||
if [ "$LAME" = "" ]; then
|
||||
echo "You need to have Lame installed to build voice files"
|
||||
echo "You currently need to have Lame installed to build voice files"
|
||||
fi
|
||||
|
||||
# echo "Encoder to use: ${LAME}${OGGENC}${SPEEXENC}(${DEFAULT_CHOICE})?"
|
||||
# echo ""
|
||||
# echo "Note: Use Lame - the other options won't work"
|
||||
# option=`input`
|
||||
# case "$option" in
|
||||
# [Oo])
|
||||
# ENCODER="oggenc"
|
||||
# ENC_OPTS=$VORBIS_OPTS
|
||||
# ;;
|
||||
# [Ss])
|
||||
# ENCODER="speexenc"
|
||||
# ENC_OPTS=$SPEEX_OPTS
|
||||
# ;;
|
||||
# [Ll])
|
||||
option="l"
|
||||
case "$option" in
|
||||
[Oo])
|
||||
ENCODER="oggenc"
|
||||
ENC_OPTS=$VORBIS_OPTS
|
||||
;;
|
||||
[Ss])
|
||||
ENCODER="speexenc"
|
||||
ENC_OPTS=$SPEEX_OPTS
|
||||
;;
|
||||
[Ll])
|
||||
ENCODER="lame"
|
||||
ENC_OPTS=$LAME_OPTS
|
||||
# ;;
|
||||
# *)
|
||||
# ENCODER=$DEFAULT_ENC
|
||||
# ENC_OPTS=$DEFAULT_ENC_OPTS
|
||||
# esac
|
||||
;;
|
||||
*)
|
||||
ENCODER=$DEFAULT_ENC
|
||||
ENC_OPTS=$DEFAULT_ENC_OPTS
|
||||
esac
|
||||
echo "Using $ENCODER for encoding voice clips"
|
||||
|
||||
# Allow the user to input manual commandline options
|
||||
printf "Enter $ENCODER options (enter for defaults `echo $ENC_OPTS |sed 's/.*=//'`): "
|
||||
USER_ENC_OPTS=`input`
|
||||
if [ -n "$USER_ENC_OPTS" ]; then
|
||||
ENC_OPTS="`echo $ENC_OPTS | sed 's/=.*//'`=\"$USER_ENC_OPTS\""
|
||||
fi
|
||||
|
||||
TEMPDIR="${pwd}"
|
||||
if [ "`which cygpath`" != "" ]; then
|
||||
TEMPDIR=`cygpath . -a -w`
|
||||
fi
|
||||
|
||||
cat > voicesettings.sh <<EOF
|
||||
cat > voicesettings-$thislang.sh <<EOF
|
||||
TTS_ENGINE="${TTS_ENGINE}"
|
||||
ENCODER="${ENCODER}"
|
||||
TEMPDIR="$TEMPDIR"
|
||||
|
|
@ -456,18 +491,26 @@ picklang() {
|
|||
done
|
||||
|
||||
read pick
|
||||
return $pick;
|
||||
}
|
||||
|
||||
whichlang() {
|
||||
num=1
|
||||
for one in $langs; do
|
||||
if [ "$num" = "$pick" ]; then
|
||||
echo $one
|
||||
return
|
||||
fi
|
||||
num=`expr $num + 1`
|
||||
output=""
|
||||
# Allow the user to pass a comma-separated list of langauges
|
||||
for thispick in `echo $pick | sed 's/,/ /g'`; do
|
||||
num=1
|
||||
for one in $langs; do
|
||||
# Accept both the language number and name
|
||||
if [ "$num" = "$thispick" ] || [ "$thispick" = "$one" ]; then
|
||||
if [ "$output" = "" ]; then
|
||||
output=$one
|
||||
else
|
||||
output=$output,$one
|
||||
fi
|
||||
fi
|
||||
num=`expr $num + 1`
|
||||
done
|
||||
done
|
||||
echo $output
|
||||
}
|
||||
|
||||
opt=$1
|
||||
|
|
@ -1429,20 +1472,6 @@ echo "Using source code root directory: $rootdir"
|
|||
# this was once possible to change at build-time, but no more:
|
||||
language="english"
|
||||
|
||||
# Ask about language if building voice
|
||||
if [ "yes" = "$voice" ]; then
|
||||
echo "Select a number for the language to use (default is english)"
|
||||
|
||||
picklang
|
||||
voicelanguage=`whichlang`
|
||||
|
||||
if [ -z "$voicelanguage" ]; then
|
||||
# pick a default
|
||||
voicelanguage="english"
|
||||
fi
|
||||
echo "Voice language set to $voicelanguage"
|
||||
fi
|
||||
|
||||
uname=`uname`
|
||||
|
||||
if [ "yes" = "$simulator" ]; then
|
||||
|
|
@ -1593,7 +1622,7 @@ sed > Makefile \
|
|||
-e "s,@MANUFACTURER@,${t_manufacturer},g" \
|
||||
-e "s,@ARCHOS@,${archos},g" \
|
||||
-e "s,@LANGUAGE@,${language},g" \
|
||||
-e "s,@VOICELANGUAGE@,${voicelanguage},g" \
|
||||
-e "s:@VOICELANGUAGE@:${voicelanguage}:g" \
|
||||
-e "s,@PWD@,${pwd},g" \
|
||||
-e "s,@CC@,${CC},g" \
|
||||
-e "s,@LD@,${LD},g" \
|
||||
|
|
@ -1794,6 +1823,9 @@ manual-ztxt:
|
|||
manual-zip:
|
||||
\$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-zip
|
||||
|
||||
features:
|
||||
\$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@ features
|
||||
|
||||
help:
|
||||
@echo "A few helpful make targets"
|
||||
@echo ""
|
||||
|
|
@ -1832,10 +1864,9 @@ if [ "yes" = "$voice" ]; then
|
|||
|
||||
cat >> Makefile <<EOF
|
||||
|
||||
voice: tools
|
||||
\$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@ features
|
||||
voice: tools features
|
||||
\$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done ; \\
|
||||
\$(TOOLSDIR)/genvoice.sh \$(ROOTDIR) \$(VOICELANGUAGE) \$(ARCHOS)\$\$feat \$(TARGET_ID) voicesettings.sh
|
||||
for lang in \`echo \$(VOICELANGUAGE) |sed "s/,/ /g"\`; do \$(TOOLSDIR)/genvoice.sh \$(ROOTDIR) \$\$lang \$(ARCHOS)\$\$feat \$(TARGET_ID) voicesettings-\$\$lang.sh ; done \\
|
||||
EOF
|
||||
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -43,14 +43,17 @@ VOICEFONTIDS=voicefontids
|
|||
|
||||
TARGET_ID="$4"
|
||||
createvoicefile() {
|
||||
RLANG="$1"
|
||||
$GENLANG -e=$ENGLISH -o -t=$TARGET $LANG_FILE > $VOICEFONTIDS
|
||||
$VOICEFONT "$VOICEFONTIDS" "$TARGET_ID" "$TEMPDIR/" "./$RLANG.voice"
|
||||
rm -f $VIOCEFONTIDS
|
||||
}
|
||||
|
||||
deletefiles() {
|
||||
# XXX: might be unsafe depending on the value of TEMPDIR
|
||||
rm -f "${TEMPDIR}"/LANG_*
|
||||
rm -f "${TEMPDIR}"/VOICE_*
|
||||
rm -f "${TEMPDIR}"/NOT_USED_*
|
||||
}
|
||||
|
||||
generateclips() {
|
||||
|
|
@ -76,17 +79,18 @@ generateclips() {
|
|||
2)
|
||||
# String
|
||||
STRING=`echo $line |cut -b 8-`
|
||||
STRING_MD5=`echo $STRING |md5sum|cut -b-32`
|
||||
# xxx: Should the hash include encoder/tts options?
|
||||
POOL_FILE=${POOL}/`echo "$STRING" |md5sum|cut -b-32`-${RLANG}.mp3
|
||||
|
||||
if [ -n "$POOL" ]; then
|
||||
# we have a common pool of snippets, check that first
|
||||
# for available mp3 sounds, and if it is available copy
|
||||
# (symlink!) it over
|
||||
if [ -f "$POOL/$STRING_MD5.mp3" ]; then
|
||||
echo "Re-using $ID from pool"
|
||||
if [ -f "$POOL_FILE" ]; then
|
||||
echo "Re-using $ID from pool (${POOL_FILE})"
|
||||
if [ ! -e "$TEMPDIR/$ID".mp3 ]; then
|
||||
# only do this if not present
|
||||
ln -s "$POOL/$STRING_MD5.mp3" "$TEMPDIR/$ID".mp3
|
||||
ln -sf "$POOL_FILE" "$TEMPDIR/$ID".mp3
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
|
@ -97,8 +101,8 @@ generateclips() {
|
|||
voice "$STRING" "$TEMPDIR/$ID".wav
|
||||
if [ -n "$POOL" ]; then
|
||||
# create it in the pool, symlink it back
|
||||
encode "$TEMPDIR/$ID".wav "$POOL/$STRING_MD5".mp3
|
||||
ln -s "$POOL/$STRING_MD5.mp3" "$TEMPDIR/$ID".mp3
|
||||
encode "$TEMPDIR/$ID".wav "$POOL_FILE"
|
||||
ln -sf "$POOL_FILE" "$TEMPDIR/$ID".mp3
|
||||
else
|
||||
encode "$TEMPDIR/$ID".wav "$TEMPDIR/$ID".mp3
|
||||
fi
|
||||
|
|
@ -118,6 +122,7 @@ else
|
|||
echo "Error: $1 is not a Rockbox directory"
|
||||
exit 33
|
||||
fi
|
||||
# Check for valid language
|
||||
if [ ! -f "$1/apps/lang/$2.lang" ]; then
|
||||
echo "Error: $2 is not a valid language"
|
||||
exit 34
|
||||
|
|
@ -125,7 +130,7 @@ else
|
|||
if [ ! -z "$5" ]; then
|
||||
if [ -f "$5" ]; then
|
||||
# Read settings from file
|
||||
source "$5"
|
||||
. "$5"
|
||||
else
|
||||
echo "Error: $5 does not exist"
|
||||
exit 36
|
||||
|
|
@ -144,5 +149,5 @@ init_tts
|
|||
init_encoder
|
||||
generateclips "$1" "$2" "$3"
|
||||
stop_tts
|
||||
createvoicefile
|
||||
#deletefiles
|
||||
createvoicefile "$2"
|
||||
deletefiles
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ FESTIVAL_HOST=localhost
|
|||
FESTIVAL_PORT=1314
|
||||
# where to log the Festival client output
|
||||
FESTIVAL_LOG=/dev/null
|
||||
# other options to the festival client
|
||||
# other options to the festival server
|
||||
FESTIVAL_OPTS=""
|
||||
|
||||
##################
|
||||
|
|
@ -140,7 +140,7 @@ init_tts() {
|
|||
exit 3
|
||||
fi
|
||||
FESTIVAL_HOST='localhost'
|
||||
$FESTIVAL_BIN --server 2>&1 > /dev/null &
|
||||
$FESTIVAL_BIN $FESTIVAL_OPTS --server 2>&1 > /dev/null &
|
||||
FESTIVAL_SERVER_PID=$!
|
||||
sleep 3
|
||||
if [ `ps | grep -c "^\ *$FESTIVAL_SERVER_PID"` -ne 1 ]; then
|
||||
|
|
@ -271,7 +271,7 @@ voice() {
|
|||
case $TTS_ENGINE in
|
||||
festival)
|
||||
echo "Action: Generate $WAV_FILE with festival"
|
||||
echo -E "$TO_SPEAK" | $FESTIVAL_CLIENT $FESTIVAL_OPTS \
|
||||
echo -E "$TO_SPEAK" | $FESTIVAL_CLIENT \
|
||||
--server $FESTIVAL_HOST \
|
||||
--otype riff --ttw --output "$WAV_FILE" 2>"$WAV_FILE"
|
||||
;;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue