summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-04-16 15:03:27 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-04-16 21:28:09 +0200
commite0d7c7c6326b0620b3969880b9b55a8e8f090a69 (patch)
treefe44a4005d1b32fee862261704dd6fac278a939a
parent84624e14f805ae5b76cc9384aa5c3d7a185727b4 (diff)
downloadrockbox-e0d7c7c6326b0620b3969880b9b55a8e8f090a69.tar.gz
rockbox-e0d7c7c6326b0620b3969880b9b55a8e8f090a69.tar.bz2
rockbox-e0d7c7c6326b0620b3969880b9b55a8e8f090a69.zip
voice: Add support for Mimic TTS engine.
...It generates decent voice files in 1/10th the time of festival. Change-Id: I1bf9271633a8a0e9c483761b8685f296d2f303b8
-rwxr-xr-xtools/configure46
-rwxr-xr-xtools/voice.pl9
2 files changed, 51 insertions, 4 deletions
diff --git a/tools/configure b/tools/configure
index 38130f85e8..eb426ec0d0 100755
--- a/tools/configure
+++ b/tools/configure
@@ -1133,6 +1133,14 @@ voiceconfig () {
DEFAULT_NOISEFLOOR="500"
DEFAULT_CHOICE="f"
fi
+ if [ -n "`findtool mimic`" ]; then
+ MIMIC="(M)imic "
+ MIMIC_OPTS=""
+ DEFAULT_TTS="mimic"
+ DEFAULT_TTS_OPTS=$MIMIC_OPTS
+ DEFAULT_NOISEFLOOR="500"
+ DEFAULT_CHOICE="M"
+ fi
if [ -n "`findtool swift`" ]; then
SWIFT="S(w)ift "
SWIFT_OPTS=""
@@ -1159,15 +1167,15 @@ voiceconfig () {
DEFAULT_CHOICE="s"
fi
- if [ "$FESTIVAL" = "$FLITE" ] && [ "$FLITE" = "$ESPEAK" ] && [ "$ESPEAK" = "$SAPI" ] && [ "$SAPI" = "$SWIFT" ] && [ "$SWIFT" = "$RBSPEAK" ]; then
- echo "You need Festival, eSpeak or Flite in your path, or SAPI available to build voice files"
+ if [ "$FESTIVAL" = "$FLITE" ] && [ "$FLITE" = "$ESPEAK" ] && [ "$ESPEAK" = "$SAPI" ] && [ "$SAPI" = "$MIMIC"] && [ "$MIMIC" = "$SWIFT" ] && [ "$SWIFT" = "$RBSPEAK" ]; then
+ echo "You need Festival, eSpeak, Mimic, Flite, or rbspeak in your path, or SAPI available to build voice files"
exit 3
fi
if [ "$ARG_TTS" ]; then
option=$ARG_TTS
else
- echo "TTS engine to use: ${FLITE}${FESTIVAL}${ESPEAK}${SAPI}${SWIFT}${RBSPEAK}(${DEFAULT_CHOICE})?"
+ echo "TTS engine to use: ${FLITE}${FESTIVAL}${ESPEAK}${MIMIC}${SAPI}${SWIFT}${RBSPEAK}(${DEFAULT_CHOICE})?"
option=`input`
if [ -z "$option" ]; then option=${DEFAULT_CHOICE}; fi
advopts="$advopts --tts=$option"
@@ -1188,6 +1196,11 @@ voiceconfig () {
NOISEFLOOR="500"
TTS_OPTS=$FESTIVAL_OPTS
;;
+ [Mm])
+ TTS_ENGINE="mimic"
+ NOISEFLOOR="500"
+ TTS_OPTS=$MIMIC_OPTS
+ ;;
[Ss])
TTS_ENGINE="sapi"
NOISEFLOOR="500"
@@ -1238,6 +1251,33 @@ voiceconfig () {
advopts="$advopts --voice=$CHOICE"
echo "Festival voice set to $TTS_FESTIVAL_VOICE"
echo "(voice_$TTS_FESTIVAL_VOICE)" > festival-prolog.scm
+ elif [ "$TTS_ENGINE" = "mimic" ]; then
+ voicelist=`mimic -lv | cut -d':' -f2`
+ for voice in $voicelist; do
+ TTS_MIMIC_VOICE="$voice" # Default choice
+ break
+ done
+ if [ "$ARG_VOICE" ]; then
+ CHOICE=$ARG_VOICE
+ else
+ i=1
+ for voice in $voicelist; do
+ printf "%3d. %s\n" "$i" "$voice"
+ i=`expr $i + 1`
+ done
+ printf "Please select which Mimic voice to use (default is $TTS_MIMIC_VOICE): "
+ CHOICE=`input`
+ fi
+ i=1
+ for voice in $voicelist; do
+ if [ "$i" = "$CHOICE" -o "$voice" = "$CHOICE" ]; then
+ TTS_MIMIC_VOICE="$voice"
+ fi
+ i=`expr $i + 1`
+ done
+ advopts="$advopts --voice=$CHOICE"
+ echo "Mimic voice set to $TTS_MIMIC_VOICE"
+ TTS_OPTS="$TTS_OPTS -voice $TTS_MIMIC_VOICE"
fi
# Read custom tts options from command line
diff --git a/tools/voice.pl b/tools/voice.pl
index f3cb860a26..8198501777 100755
--- a/tools/voice.pl
+++ b/tools/voice.pl
@@ -192,6 +192,13 @@ sub voicestring {
print RBSPEAK $string . "\n";
close(RBSPEAK);
}
+ elsif ($name eq 'mimic') {
+ $cmd = "mimic $tts_engine_opts -o $output";
+ print("> $cmd\n") if $verbose;
+ open (MIMIC, "| $cmd");
+ print MIMIC $string . "\n";
+ close(MIMIC);
+ }
}
# trim leading / trailing silence from the clip
@@ -305,7 +312,7 @@ sub generateclips {
# If we have a pool of snippets, see if the string exists there first
if (defined($ENV{'POOL'})) {
- $pool_file = sprintf("%s/%s-%s.mp3", $ENV{'POOL'},
+ $pool_file = sprintf("%s/%s-%s.mp3", $ENV{'POOL'},
md5_hex("$voice $tts_engine $tts_engine_opts $encoder_opts"),
$language);
if (-f $pool_file) {