From 8f75b29aed8eeb901244a715595c93656dc18b72 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Sun, 23 Jun 2024 19:33:22 -0400 Subject: voice.pl: Fix an issue with the piper tts engine It only arose with the dailybuild scripts. Change-Id: Iefb0fbab39846df6e52b3860f3d74e6dc9c39305 --- tools/voice.pl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/voice.pl b/tools/voice.pl index 1b58f5a67f..1c547c7d96 100755 --- a/tools/voice.pl +++ b/tools/voice.pl @@ -178,6 +178,10 @@ sub init_tts { $ret{"ttsoptions"} = "--language $festival_lang_map{$language} "; } } elsif ($tts_engine eq 'piper') { + if (defined($piper_lang_map{$language}) && $tts_engine_opts !~ /--model/) { + die("Need PIPER_MODEL_DIR\n") if (!defined($ENV{'PIPER_MODEL_DIR'})); + $tts_engine_opts = "--model $ENV{PIPER_MODEL_DIR}/$piper_lang_map{$language} "; + } my $cmd = "piper $tts_engine_opts --json-input"; print("> $cmd\n") if $verbose; @@ -188,10 +192,7 @@ sub init_tts { binmode(*CMD_IN, ':encoding(utf8)'); binmode(*CMD_OUT, ':encoding(utf8)'); binmode(*CMD_ERR, ':encoding(utf8)'); - if (defined($piper_lang_map{$language}) && $tts_engine_opts !~ /--model/) { - die("Need PIPER_MODEL_DIR\n") if (!defined($ENV{'PIPER_MODEL_DIR'})); - $ret{"ttsoptions"} = "--model $ENV{PIPER_MODEL_DIR}/$piper_lang_map{$language} "; - } + } elsif ($tts_engine eq 'sapi') { my $toolsdir = dirname($0); my $path = `cygpath $toolsdir -a -w`; -- cgit v1.2.3