summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/root.make12
-rwxr-xr-xtools/voice.pl13
2 files changed, 21 insertions, 4 deletions
diff --git a/tools/root.make b/tools/root.make
index 03c4d48986..37aeaadaff 100644
--- a/tools/root.make
+++ b/tools/root.make
@@ -374,7 +374,17 @@ ifdef TTS_ENGINE
374 374
375voice: voicetools $(BUILDDIR)/apps/features 375voice: voicetools $(BUILDDIR)/apps/features
376 $(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done ; \ 376 $(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done ; \
377 for lang in `echo $(VOICELANGUAGE) |sed "s/,/ /g"`; do $(TOOLSDIR)/voice.pl -V -l=$$lang -t=$(MODELNAME)$$feat -i=$(TARGET_ID) -e="$(ENCODER)" -E="$(ENC_OPTS)" -s=$(TTS_ENGINE) -S="$(TTS_OPTS)"; done \ 377 for lang in `echo $(VOICELANGUAGE) |sed "s/,/ /g"`; do $(TOOLSDIR)/voice.pl -V -l=$$lang -t=$(MODELNAME)$$feat -i=$(TARGET_ID) -e="$(ENCODER)" -E="$(ENC_OPTS)" -s=$(TTS_ENGINE) -S="$(TTS_OPTS)"; done
378
379talkclips: voicetools
380 $(SILENT)if [ -z '$(TALKDIR)' ] ; then \
381 echo "Must specify TALKDIR"; \
382 else \
383 for lang in `echo $(VOICELANGUAGE) |sed "s/,/ /g"`; do $(TOOLSDIR)/voice.pl -C -l=$$lang -e="$(ENCODER)" -E="$(ENC_OPTS)" -s=$(TTS_ENGINE) -S="$(TTS_OPTS)" $(FORCE) "$(TALKDIR)" ; done \
384 fi
385
386talkclips-force: FORCE=-F
387talkclips-force: talkclips
378 388
379endif 389endif
380 390
diff --git a/tools/voice.pl b/tools/voice.pl
index 08f6bad509..2cb7867eb2 100755
--- a/tools/voice.pl
+++ b/tools/voice.pl
@@ -19,7 +19,7 @@ use strict;
19use warnings; 19use warnings;
20use File::Basename; 20use File::Basename;
21use File::Copy; 21use File::Copy;
22use vars qw($V $C $t $l $e $E $s $S $i $v $f); 22use vars qw($V $C $t $l $e $E $s $S $i $v $f $F);
23use IPC::Open2; 23use IPC::Open2;
24use IPC::Open3; 24use IPC::Open3;
25use Digest::MD5 qw(md5_hex); 25use Digest::MD5 qw(md5_hex);
@@ -64,6 +64,8 @@ Usage: voice.pl [options] [path to dir]
64 Options to pass to the TTS engine. Enclose in double quotes if the 64 Options to pass to the TTS engine. Enclose in double quotes if the
65 options include spaces. 65 options include spaces.
66 66
67 -F Force the file to be regenerated even if present
68
67 -v 69 -v
68 Be verbose 70 Be verbose
69USAGE 71USAGE
@@ -125,6 +127,7 @@ my %espeak_lang_map = (
125); 127);
126 128
127my $trim_thresh = 500; # Trim silence if over this, in ms 129my $trim_thresh = 500; # Trim silence if over this, in ms
130my $force = 0; # Don't regenerate files already present
128 131
129# Initialize TTS engine. May return an object or value which will be passed 132# Initialize TTS engine. May return an object or value which will be passed
130# to voicestring and shutdown_tts 133# to voicestring and shutdown_tts
@@ -427,7 +430,7 @@ sub generateclips {
427 } 430 }
428 431
429 # Don't generate encoded file if it already exists (probably from the POOL) 432 # Don't generate encoded file if it already exists (probably from the POOL)
430 if (! -f $enc) { 433 if (! -f $enc && !$force) {
431 if ($id eq "VOICE_PAUSE") { 434 if ($id eq "VOICE_PAUSE") {
432 print("Use distributed $wav\n") if $verbose; 435 print("Use distributed $wav\n") if $verbose;
433 copy(dirname($0)."/VOICE_PAUSE.wav", $wav); 436 copy(dirname($0)."/VOICE_PAUSE.wav", $wav);
@@ -540,7 +543,7 @@ sub gentalkclips {
540 543
541 printf("Talkclip %s: %s", $enc, $voice) if $verbose; 544 printf("Talkclip %s: %s", $enc, $voice) if $verbose;
542 # Don't generate encoded file if it already exists 545 # Don't generate encoded file if it already exists
543 next if (-f $enc); 546 next if (-f $enc && !$force);
544 547
545 voicestring($voice, $wav, $tts_engine_opts, $tts_object); 548 voicestring($voice, $wav, $tts_engine_opts, $tts_object);
546 wavtrim($wav, $trim_thresh, $tts_object); 549 wavtrim($wav, $trim_thresh, $tts_object);
@@ -563,6 +566,7 @@ sub gentalkclips {
563 566
564# Check parameters 567# Check parameters
565my $printusage = 0; 568my $printusage = 0;
569
566unless (defined($V) or defined($C)) { print("Missing either -V or -C\n"); $printusage = 1; } 570unless (defined($V) or defined($C)) { print("Missing either -V or -C\n"); $printusage = 1; }
567if (defined($V)) { 571if (defined($V)) {
568 unless (defined($l)) { print("Missing -l argument\n"); $printusage = 1; } 572 unless (defined($l)) { print("Missing -l argument\n"); $printusage = 1; }
@@ -575,6 +579,9 @@ if (defined($V)) {
575elsif (defined($C)) { 579elsif (defined($C)) {
576 unless (defined($ARGV[0])) { print "Missing path argument\n"; $printusage = 1; } 580 unless (defined($ARGV[0])) { print "Missing path argument\n"; $printusage = 1; }
577} 581}
582
583$force = 1 if (defined($F));
584
578unless (defined($e)) { print("Missing -e argument\n"); $printusage = 1; } 585unless (defined($e)) { print("Missing -e argument\n"); $printusage = 1; }
579unless (defined($E)) { print("Missing -E argument\n"); $printusage = 1; } 586unless (defined($E)) { print("Missing -E argument\n"); $printusage = 1; }
580unless (defined($s)) { print("Missing -s argument\n"); $printusage = 1; } 587unless (defined($s)) { print("Missing -s argument\n"); $printusage = 1; }