voice: Add support for Mimic TTS engine.

...It generates decent voice files in 1/10th the time of festival.

Change-Id: I1bf9271633a8a0e9c483761b8685f296d2f303b8
This commit is contained in:
Solomon Peachy 2020-04-16 15:03:27 -04:00
parent 84624e14f8
commit e0d7c7c632
2 changed files with 51 additions and 4 deletions

46
tools/configure vendored
View file

@ -1133,6 +1133,14 @@ voiceconfig () {
DEFAULT_NOISEFLOOR="500" DEFAULT_NOISEFLOOR="500"
DEFAULT_CHOICE="f" DEFAULT_CHOICE="f"
fi 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 if [ -n "`findtool swift`" ]; then
SWIFT="S(w)ift " SWIFT="S(w)ift "
SWIFT_OPTS="" SWIFT_OPTS=""
@ -1159,15 +1167,15 @@ voiceconfig () {
DEFAULT_CHOICE="s" DEFAULT_CHOICE="s"
fi fi
if [ "$FESTIVAL" = "$FLITE" ] && [ "$FLITE" = "$ESPEAK" ] && [ "$ESPEAK" = "$SAPI" ] && [ "$SAPI" = "$SWIFT" ] && [ "$SWIFT" = "$RBSPEAK" ]; then if [ "$FESTIVAL" = "$FLITE" ] && [ "$FLITE" = "$ESPEAK" ] && [ "$ESPEAK" = "$SAPI" ] && [ "$SAPI" = "$MIMIC"] && [ "$MIMIC" = "$SWIFT" ] && [ "$SWIFT" = "$RBSPEAK" ]; then
echo "You need Festival, eSpeak or Flite in your path, or SAPI available to build voice files" echo "You need Festival, eSpeak, Mimic, Flite, or rbspeak in your path, or SAPI available to build voice files"
exit 3 exit 3
fi fi
if [ "$ARG_TTS" ]; then if [ "$ARG_TTS" ]; then
option=$ARG_TTS option=$ARG_TTS
else 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` option=`input`
if [ -z "$option" ]; then option=${DEFAULT_CHOICE}; fi if [ -z "$option" ]; then option=${DEFAULT_CHOICE}; fi
advopts="$advopts --tts=$option" advopts="$advopts --tts=$option"
@ -1188,6 +1196,11 @@ voiceconfig () {
NOISEFLOOR="500" NOISEFLOOR="500"
TTS_OPTS=$FESTIVAL_OPTS TTS_OPTS=$FESTIVAL_OPTS
;; ;;
[Mm])
TTS_ENGINE="mimic"
NOISEFLOOR="500"
TTS_OPTS=$MIMIC_OPTS
;;
[Ss]) [Ss])
TTS_ENGINE="sapi" TTS_ENGINE="sapi"
NOISEFLOOR="500" NOISEFLOOR="500"
@ -1238,6 +1251,33 @@ voiceconfig () {
advopts="$advopts --voice=$CHOICE" advopts="$advopts --voice=$CHOICE"
echo "Festival voice set to $TTS_FESTIVAL_VOICE" echo "Festival voice set to $TTS_FESTIVAL_VOICE"
echo "(voice_$TTS_FESTIVAL_VOICE)" > festival-prolog.scm 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 fi
# Read custom tts options from command line # Read custom tts options from command line

View file

@ -192,6 +192,13 @@ sub voicestring {
print RBSPEAK $string . "\n"; print RBSPEAK $string . "\n";
close(RBSPEAK); 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 # 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 we have a pool of snippets, see if the string exists there first
if (defined($ENV{'POOL'})) { 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"), md5_hex("$voice $tts_engine $tts_engine_opts $encoder_opts"),
$language); $language);
if (-f $pool_file) { if (-f $pool_file) {