diff options
Diffstat (limited to 'tools/voice.pl')
-rwxr-xr-x | tools/voice.pl | 71 |
1 files changed, 51 insertions, 20 deletions
diff --git a/tools/voice.pl b/tools/voice.pl index 3c7d36bf71..805fe718f8 100755 --- a/tools/voice.pl +++ b/tools/voice.pl | |||
@@ -91,7 +91,15 @@ sub init_tts { | |||
91 | my $pid = open2(*CMD_OUT, *CMD_IN, "cscript //nologo $cmd"); | 91 | my $pid = open2(*CMD_OUT, *CMD_IN, "cscript //nologo $cmd"); |
92 | $SIG{INT} = sub { print(CMD_IN "QUIT\r\n"); panic_cleanup(); }; | 92 | $SIG{INT} = sub { print(CMD_IN "QUIT\r\n"); panic_cleanup(); }; |
93 | $SIG{KILL} = sub { print(CMD_IN "QUIT\r\n"); panic_cleanup(); }; | 93 | $SIG{KILL} = sub { print(CMD_IN "QUIT\r\n"); panic_cleanup(); }; |
94 | %ret = (%ret, "stdin" => *CMD_IN, "stdout" => *CMD_OUT, "toolspath" => $path); | 94 | print(CMD_IN "QUERY\tVENDOR\r\n"); |
95 | my $vendor = readline(CMD_OUT); | ||
96 | $vendor =~ s/\r\n//; | ||
97 | print("$vendor\n"); | ||
98 | %ret = (%ret, | ||
99 | "stdin" => *CMD_IN, | ||
100 | "stdout" => *CMD_OUT, | ||
101 | "toolspath" => $path, | ||
102 | "vendor" => $vendor); | ||
95 | } | 103 | } |
96 | } | 104 | } |
97 | return \%ret; | 105 | return \%ret; |
@@ -118,24 +126,45 @@ sub correct_string { | |||
118 | my ($string, $language, $tts_object) = @_; | 126 | my ($string, $language, $tts_object) = @_; |
119 | my $orig = $string; | 127 | my $orig = $string; |
120 | switch($language) { | 128 | switch($language) { |
121 | # General for all engines and languages (perhaps - just an example) | 129 | # General for all engines and languages |
122 | $string =~ s/USB/U S B/; | 130 | $string =~ s/USB/U S B/ig; |
131 | $string =~ s/ID3/I D 3/ig; | ||
123 | 132 | ||
124 | case ("deutsch") { | 133 | case "english" { |
125 | switch($$tts_object{"name"}) { | 134 | switch($$tts_object{"name"}) { |
126 | $string =~ s/alphabet/alfabet/; | 135 | case "sapi" { # just for SAPI |
127 | $string =~ s/alkaline/alkalein/; | 136 | $string =~ s/plugin(s?)/plug-in$1/ig; |
128 | $string =~ s/ampere/amper/; | 137 | } |
129 | $string =~ s/byte(s?)\b/beit$1/; | 138 | } |
130 | $string =~ s/\bdezibel\b/de-zibell/; | 139 | } |
131 | $string =~ s/energie\b/ener-gie/; | 140 | case "deutsch" { |
132 | $string =~ s/\bflash\b/fläsh/g; | 141 | # for all german engines (e.g. for english words) |
133 | $string =~ s/\bfirmware(s?)\b/firmwer$1/; | 142 | $string =~ s/alkaline/alkalein/ig; |
134 | $string =~ s/\bid3 tag\b/id3 täg/g; # can't just use "tag" here | 143 | $string =~ s/byte(s?)/beit$1/ig; |
135 | $string =~ s/\bloudness\b/laudness/; | 144 | $string =~ s/clip(s?)/klipp$1/ig; |
136 | $string =~ s/\bnumerisch\b/numehrisch/; | 145 | $string =~ s/cuesheet/kjuschiet/ig; |
137 | $string =~ s/\brücklauf\b/rück-lauf/; | 146 | $string =~ s/dither/didder/ig; |
138 | $string =~ s/\bsuchlauf\b/such-lauf/; | 147 | $string =~ s/equalizer/iquileiser/ig; |
148 | $string =~ s/\bflash\b/fläsh/ig; | ||
149 | $string =~ s/\bfirmware(s?)\b/firmwer$1/ig; | ||
150 | $string =~ s/\bI D 3 tag\b/I D 3 täg/ig; # can't just use "tag" here | ||
151 | $string =~ s/\bloudness\b/laudness/ig; | ||
152 | $string =~ s/\bunicode\b/unikod/ig; | ||
153 | switch($$tts_object{"name"}) { | ||
154 | case "sapi" { # just for SAPI | ||
155 | switch($$tts_object{"vendor"}) { | ||
156 | case "AT&T Labs" { | ||
157 | $string =~ s/alphabet/alfabet/ig; | ||
158 | $string =~ s/ampere/amper/ig; | ||
159 | $string =~ s/\bdezibel\b/de-zibell/ig; | ||
160 | $string =~ s/diddering/didde-ring/ig; | ||
161 | $string =~ s/energie\b/ener-gie/ig; | ||
162 | $string =~ s/\bnumerisch\b/numehrisch/ig; | ||
163 | $string =~ s/\brücklauf\b/rück-lauf/ig; | ||
164 | $string =~ s/\bsuchlauf\b/such-lauf/ig; | ||
165 | } | ||
166 | } | ||
167 | } | ||
139 | } | 168 | } |
140 | } | 169 | } |
141 | } | 170 | } |
@@ -280,11 +309,13 @@ sub generateclips { | |||
280 | } | 309 | } |
281 | 310 | ||
282 | # Apply corrections to the string | 311 | # Apply corrections to the string |
283 | $voice = correct_string($voice); | 312 | $voice = correct_string($voice, $language, $tts_object); |
284 | 313 | ||
285 | # If we have a pool of snippes, see if the string exists there first | 314 | # If we have a pool of snippets, see if the string exists there first |
286 | if (defined($ENV{'POOL'})) { | 315 | if (defined($ENV{'POOL'})) { |
287 | $pool_file = sprintf("%s/%s-%s-%s.mp3", $ENV{'POOL'}, md5_hex($voice), $language, $tts_engine); | 316 | $pool_file = sprintf("%s/%s-%s.mp3", $ENV{'POOL'}, |
317 | md5_hex("$voice $tts_engine $tts_engine_opts $encoder_opts"), | ||
318 | $language); | ||
288 | if (-f $pool_file) { | 319 | if (-f $pool_file) { |
289 | printf("Re-using %s (%s) from pool\n", $id, $voice) if $verbose; | 320 | printf("Re-using %s (%s) from pool\n", $id, $voice) if $verbose; |
290 | copy($pool_file, $mp3); | 321 | copy($pool_file, $mp3); |