summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/voice.pl16
1 files changed, 7 insertions, 9 deletions
diff --git a/tools/voice.pl b/tools/voice.pl
index 9398b58b47..08f6bad509 100755
--- a/tools/voice.pl
+++ b/tools/voice.pl
@@ -335,7 +335,7 @@ sub synchronize {
335# Run genlang and create voice clips for each string 335# Run genlang and create voice clips for each string
336sub generateclips { 336sub generateclips {
337 our $verbose; 337 our $verbose;
338 my ($language, $target, $encoder, $encoder_opts, $tts_engine, $tts_engine_opts, $existingids) = @_; 338 my ($language, $target, $encoder, $encoder_opts, $tts_object, $tts_engine_opts, $existingids) = @_;
339 my $english = dirname($0) . '/../apps/lang/english.lang'; 339 my $english = dirname($0) . '/../apps/lang/english.lang';
340 my $langfile = dirname($0) . '/../apps/lang/' . $language . '.lang'; 340 my $langfile = dirname($0) . '/../apps/lang/' . $language . '.lang';
341 my $correctionsfile = dirname($0) . '/voice-corrections.txt'; 341 my $correctionsfile = dirname($0) . '/voice-corrections.txt';
@@ -362,7 +362,6 @@ sub generateclips {
362 } 362 }
363 open(VOICEFONTIDS, " < $idfile"); 363 open(VOICEFONTIDS, " < $idfile");
364 364
365 my $tts_object = init_tts($tts_engine, $tts_engine_opts, $language);
366 # add string corrections to tts_object. 365 # add string corrections to tts_object.
367 my @corrects = (); 366 my @corrects = ();
368 open(VOICEREGEXP, "<$correctionsfile") or die "Can't open corrections file!\n"; 367 open(VOICEREGEXP, "<$correctionsfile") or die "Can't open corrections file!\n";
@@ -419,7 +418,7 @@ sub generateclips {
419 # If we have a pool of snippets, see if the string exists there first 418 # If we have a pool of snippets, see if the string exists there first
420 if (defined($ENV{'POOL'})) { 419 if (defined($ENV{'POOL'})) {
421 $pool_file = sprintf("%s/%s-%s.enc", $ENV{'POOL'}, 420 $pool_file = sprintf("%s/%s-%s.enc", $ENV{'POOL'},
422 md5_hex(Encode::encode_utf8("$voice $tts_engine $tts_engine_opts $encoder_opts")), 421 md5_hex(Encode::encode_utf8("$voice ". $tts_object->{"name"}." $tts_engine_opts $encoder_opts")),
423 $language); 422 $language);
424 if (-f $pool_file) { 423 if (-f $pool_file) {
425 printf("Re-using %s (%s) from pool\n", $id, $voice) if $verbose; 424 printf("Re-using %s (%s) from pool\n", $id, $voice) if $verbose;
@@ -589,6 +588,8 @@ if (defined($v) or defined($ENV{'V'})) {
589# add the tools dir to the path temporarily, for calling various tools 588# add the tools dir to the path temporarily, for calling various tools
590$ENV{'PATH'} = dirname($0) . ':' . $ENV{'PATH'}; 589$ENV{'PATH'} = dirname($0) . ':' . $ENV{'PATH'};
591 590
591my $tts_object = init_tts($s, $S, $l);
592
592# Do what we're told 593# Do what we're told
593if ($V == 1) { 594if ($V == 1) {
594 # Only do the panic cleanup for voicefiles 595 # Only do the panic cleanup for voicefiles
@@ -598,17 +599,14 @@ if ($V == 1) {
598 printf("Generating voice\n Target: %s\n Language: %s\n Encoder (options): %s (%s)\n TTS Engine (options): %s (%s)\n", 599 printf("Generating voice\n Target: %s\n Language: %s\n Encoder (options): %s (%s)\n TTS Engine (options): %s (%s)\n",
599 defined($t) ? $t : "unknown", 600 defined($t) ? $t : "unknown",
600 $l, $e, $E, $s, $S); 601 $l, $e, $E, $s, $S);
601 generateclips($l, $t, $e, $E, $s, $S, $f); 602 generateclips($l, $t, $e, $E, $tts_object, $S, $f);
602 createvoice($l, $i, $f); 603 createvoice($l, $i, $f);
603 deleteencs(); 604 deleteencs();
604} 605} elsif ($C) {
605elsif ($C) {
606 printf("Generating .talk clips\n Path: %s\n Language: %s\n Encoder (options): %s (%s)\n TTS Engine (options): %s (%s)\n", $ARGV[0], $l, $e, $E, $s, $S); 606 printf("Generating .talk clips\n Path: %s\n Language: %s\n Encoder (options): %s (%s)\n TTS Engine (options): %s (%s)\n", $ARGV[0], $l, $e, $E, $s, $S);
607 my $tts_object = init_tts($s, $S, $l);
608 gentalkclips($ARGV[0], $tts_object, $e, $E, $S, 0); 607 gentalkclips($ARGV[0], $tts_object, $e, $E, $S, 0);
609 shutdown_tts($tts_object); 608 shutdown_tts($tts_object);
610} 609} else {
611else {
612 printusage(); 610 printusage();
613 exit 1; 611 exit 1;
614} 612}