summaryrefslogtreecommitdiff
path: root/tools/voice.pl
diff options
context:
space:
mode:
Diffstat (limited to 'tools/voice.pl')
-rwxr-xr-xtools/voice.pl40
1 files changed, 27 insertions, 13 deletions
diff --git a/tools/voice.pl b/tools/voice.pl
index 1c547c7d96..1180565b64 100755
--- a/tools/voice.pl
+++ b/tools/voice.pl
@@ -8,6 +8,7 @@
8# $Id$ 8# $Id$
9# 9#
10# Copyright (C) 2007 Jonas Häggqvist 10# Copyright (C) 2007 Jonas Häggqvist
11# Copyright (C) 2020 Solomon Peachy
11# 12#
12# All files in this archive are subject to the GNU General Public License. 13# All files in this archive are subject to the GNU General Public License.
13# See the file COPYING in the source tree root for full license agreement. 14# See the file COPYING in the source tree root for full license agreement.
@@ -87,6 +88,8 @@ my %festival_lang_map = (
87 88
88my %gtts_lang_map = ( 89my %gtts_lang_map = (
89 'english' => '-l en -t co.uk', # Always first, it's the golden master 90 'english' => '-l en -t co.uk', # Always first, it's the golden master
91 'bulgarian' => '-l bg',
92 'chinese-simp' => '-l zh',
90 'czech' => '-l cs', 93 'czech' => '-l cs',
91 'dansk' => '-l da', 94 'dansk' => '-l da',
92 'deutsch' => '-l de', 95 'deutsch' => '-l de',
@@ -95,8 +98,9 @@ my %gtts_lang_map = (
95 'espanol' => '-l es', 98 'espanol' => '-l es',
96 'francais' => '-l fr', 99 'francais' => '-l fr',
97 'greek' => '-l el', 100 'greek' => '-l el',
98 'magyar' => '-l hu',
99 'italiano' => '-l it', 101 'italiano' => '-l it',
102 'korean' => '-l ko',
103 'magyar' => '-l hu',
100 'nederlands' => '-l nl', 104 'nederlands' => '-l nl',
101 'norsk' => '-l no', 105 'norsk' => '-l no',
102 'polski' => '-l pl', 106 'polski' => '-l pl',
@@ -109,6 +113,8 @@ my %gtts_lang_map = (
109 113
110my %espeak_lang_map = ( 114my %espeak_lang_map = (
111 'english' => '-ven-gb -k 5', # Always first, it's the golden master 115 'english' => '-ven-gb -k 5', # Always first, it's the golden master
116 'bulgarian' => '-vbg',
117 'chinese-simp' => '-vzh',
112 'czech' => '-vcs', 118 'czech' => '-vcs',
113 'dansk' => '-vda', 119 'dansk' => '-vda',
114 'deutsch' => '-vde', 120 'deutsch' => '-vde',
@@ -117,9 +123,10 @@ my %espeak_lang_map = (
117 'espanol' => '-ves', 123 'espanol' => '-ves',
118 'francais' => '-vfr-fr', 124 'francais' => '-vfr-fr',
119 'greek' => '-vel', 125 'greek' => '-vel',
120 'magyar' => '-vhu',
121 'italiano' => '-vit', 126 'italiano' => '-vit',
122 'japanese' => '-vja', 127 'japanese' => '-vja',
128 'korean' => '-vko',
129 'magyar' => '-vhu',
123 'nederlands' => '-vnl', 130 'nederlands' => '-vnl',
124 'norsk' => '-vno', 131 'norsk' => '-vno',
125 'polski' => '-vpl', 132 'polski' => '-vpl',
@@ -131,7 +138,9 @@ my %espeak_lang_map = (
131 ); 138 );
132 139
133my %piper_lang_map = ( 140my %piper_lang_map = (
134 'english' => 'en_GB-cori-high.onnx', # Always first, it's the golden master 141 'english' => 'en_GB-semaine-medium.onnx', # Always first, it's the golden master
142# 'bulgarian' => '-vbg',
143 'chinese-simp' => 'zh_CN-huayan-medium.onnx',
135 'czech' => 'cs_CZ-jirka-medium.onnx', 144 'czech' => 'cs_CZ-jirka-medium.onnx',
136 'dansk' => 'da_DK-talesyntese-medium.onnx', 145 'dansk' => 'da_DK-talesyntese-medium.onnx',
137 'deutsch' => 'de_DE-thorsten-high.onnx', 146 'deutsch' => 'de_DE-thorsten-high.onnx',
@@ -140,9 +149,10 @@ my %piper_lang_map = (
140 'espanol' => 'es_ES-sharvard-medium.onnx', 149 'espanol' => 'es_ES-sharvard-medium.onnx',
141 'francais' => 'fr_FR-siwis-medium.onnx', 150 'francais' => 'fr_FR-siwis-medium.onnx',
142 'greek' => 'el_GR-rapunzelina-low.onnx', 151 'greek' => 'el_GR-rapunzelina-low.onnx',
143 'magyar' => 'hu_HU-anna-medium.onnx',
144 'italiano' => 'it_IT-paola-medium.onnx', 152 'italiano' => 'it_IT-paola-medium.onnx',
145# 'japanese' => '-vja', 153# 'japanese' => '-vja',
154# 'korean' => '-vko',
155 'magyar' => 'hu_HU-anna-medium.onnx',
146 'nederlands' => 'nl_NL-mls-medium.onnx', 156 'nederlands' => 'nl_NL-mls-medium.onnx',
147 'norsk' => 'no_NO-talesyntese-medium.onnx', 157 'norsk' => 'no_NO-talesyntese-medium.onnx',
148 'polski' => 'pl_PL-gosia-medium.onnx', 158 'polski' => 'pl_PL-gosia-medium.onnx',
@@ -153,7 +163,7 @@ my %piper_lang_map = (
153 'turkce' => 'tr_TR-fettah-medium.onnx', 163 'turkce' => 'tr_TR-fettah-medium.onnx',
154); 164);
155 165
156my $trim_thresh = 500; # Trim silence if over this, in ms 166my $trim_thresh = 250; # Trim silence if over this, in ms
157my $force = 0; # Don't regenerate files already present 167my $force = 0; # Don't regenerate files already present
158 168
159# Initialize TTS engine. May return an object or value which will be passed 169# Initialize TTS engine. May return an object or value which will be passed
@@ -476,7 +486,7 @@ sub generateclips {
476 # If we have a pool of snippets, see if the string exists there first 486 # If we have a pool of snippets, see if the string exists there first
477 if (defined($ENV{'POOL'})) { 487 if (defined($ENV{'POOL'})) {
478 $pool_file = sprintf("%s/%s-%s.enc", $ENV{'POOL'}, 488 $pool_file = sprintf("%s/%s-%s.enc", $ENV{'POOL'},
479 md5_hex(Encode::encode_utf8("$voice ". $tts_object->{"name"}." $tts_engine_opts $encoder_opts")), 489 md5_hex(Encode::encode_utf8("$voice ". $tts_object->{"name"}." $tts_engine_opts ".$tts_object->{"ttsoptions"}." $encoder_opts")),
480 $language); 490 $language);
481 if (-f $pool_file) { 491 if (-f $pool_file) {
482 printf("Re-using %s (%s) from pool\n", $id, $voice) if $verbose; 492 printf("Re-using %s (%s) from pool\n", $id, $voice) if $verbose;
@@ -585,17 +595,21 @@ sub gentalkclips {
585 print("."); 595 print(".");
586 } 596 }
587 597
588 # Convert to a complete path
589 my $path = sprintf("%s/%s", $dir, $file);
590
591 $voice = $file;
592 $wav = sprintf("%s.talk.wav", $path);
593
594 # Ignore dot-dirs and talk files 598 # Ignore dot-dirs and talk files
595 if ($file eq '.' || $file eq '..' || $file =~ /\.talk$/) { 599 if ($file eq '.' || $file eq '..' || $file =~ /\.talk$/) {
596 next; 600 next;
597 } 601 }
598 602
603 $voice = $file;
604
605 # Convert some symbols to spaces
606 $voice =~ tr/_-/ /;
607
608 # Convert to a complete path
609 my $path = sprintf("%s/%s", $dir, $file);
610
611 $wav = sprintf("%s.talk.wav", $path);
612
599 if ( -d $path) { # Element is a dir 613 if ( -d $path) { # Element is a dir
600 $enc = sprintf("%s/_dirname.talk", $path); 614 $enc = sprintf("%s/_dirname.talk", $path);
601 if (! -e "$path/talkclips.ignore") { # Skip directories containing "talkclips.ignore" 615 if (! -e "$path/talkclips.ignore") { # Skip directories containing "talkclips.ignore"
@@ -670,7 +684,7 @@ if ($V == 1) {
670 684
671 printf("Generating voice\n Target: %s\n Language: %s\n Encoder (options): %s (%s)\n TTS Engine (options): %s (%s)\n Pool directory: %s\n", 685 printf("Generating voice\n Target: %s\n Language: %s\n Encoder (options): %s (%s)\n TTS Engine (options): %s (%s)\n Pool directory: %s\n",
672 defined($t) ? $t : "unknown", 686 defined($t) ? $t : "unknown",
673 $l, $e, $E, $s, $S, defined($ENV{'POOL'}) ? $ENV{'POOL'} : "<none>"); 687 $l, $e, $E, $s, "$S $tts_object->{ttsoptions}", defined($ENV{'POOL'}) ? $ENV{'POOL'} : "<none>");
674 generateclips($l, $t, $e, $E, $tts_object, $S, $f); 688 generateclips($l, $t, $e, $E, $tts_object, $S, $f);
675 shutdown_tts($tts_object); 689 shutdown_tts($tts_object);
676 createvoice($l, $i, $f); 690 createvoice($l, $i, $f);