[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Search]

misc. changes to servers/espeak



The procedures tts_allcaps_beep, tts_split_caps, and tts_capitalize had
brackets in expressions, but parentheses were needed.  TCL tries to do
command substitution when these procedures are invoked with an argument of 0.
You can see what I mean by using the TCL interpreter:

tcl ./servers/espeak
% tts_capitalize 0
# Produces an error when TCL tries to do command substitution.
% tts_split_caps 0
# same
% tts_allcaps_beep 0
# same

This is fixed by my diff.

Users probably want to disable dtk-split-caps when using ESpeak.
When dtk-split-caps is enabled, ESpeak renders camel-cased identifiers thusly.
camelCasedName produces the speech "camel capital cased capital name".
That is a feature.  However, if you disable dtk-split-caps,
ESpeak renders camelCasedName as "camel cased name".  It may indicate 
capitals with pitch or beeps, depending on the settings of dtk-capitalize
and dtk-allcaps-beep.
Regardless, ESpeak always converts camelCasedName into three distinct tokens.

I changed the two procedures that set speech rate.
tts_speech_rate and r now use the setRate procedure, which was already defined
in linux-espeak/tclespeak.cpp.
This change means that the TTS server no longer needs to send
<prosody rate=...>
SSML tags to control ESpeak's speaking rate.

Regards,
-- Chris
Index: servers/espeak
===================================================================
--- servers/espeak	(revision 5920)
+++ servers/espeak	(working copy)
@@ -213,19 +213,12 @@
     return ""
 }
 
-proc convert_speech_rate {rate} {
-    global tts
-
-    set value [ expr ( int (0.0606 * $rate))/10.0 ]
-    return $value
-}
-
 proc tts_set_speech_rate {rate} {
     global tts
 
     set factor $tts(char_factor) 
     set tts(speech_rate) $rate
-    say "<prosody rate=\"[convert_speech_rate $rate]\">"
+    setRate 0 $rate
     service
     return ""
 }
@@ -246,10 +239,9 @@
     global langsynth
 
     service 
-    set r $tts(speech_rate)
     set la $langcode(current)
 
-    set prefix "<voice xml:lang=\"$la\" gender=\"male\" variant=\"1\"><prosody rate=\"[convert_speech_rate $r]\">"
+    set prefix "<voice xml:lang=\"$la\" gender=\"male\" variant=\"1\">"
     regsub -all {\[\*\]} $text { } text 
     synth " $prefix $text"
     service
@@ -261,10 +253,8 @@
     global langcode
     global langsynth
 
-    set r $tts(speech_rate)
     set la $langcode(current)
-    set r2 [ convert_speech_rate $r ]
-    set prefix "<voice xml:lang=\"$la\" gender=\"male\" variant=\"1\"><prosody rate=\"$r2\">"
+    set prefix "<voice xml:lang=\"$la\" gender=\"male\" variant=\"1\">"
     if {[regexp  {[A-Z]} $text]} {
 	# pitch instead of 80%, high which could be 75%.
         set prefix "$prefix <prosody pitch=\"high\">"
@@ -341,7 +331,7 @@
 	set tts(capitalize) 0
 	caps "spelling"
     } else {
-	if { [ $tts(capitalize) == 0 ] && [ $tts(allcaps_beep) == 0 ] } {
+	if { ( $tts(capitalize) == 0 ) && ( $tts(allcaps_beep) == 0 ) } {
 	    caps "none"
 	}
     }
@@ -359,7 +349,7 @@
 	set tts(allcaps_beep) 0
 	caps "pitch"
     } else {
-	if { [ $tts(split_caps) == 0 ] && [ $tts(allcaps_beep) == 0 ] } {
+	if { ( $tts(split_caps) == 0 ) && ( $tts(allcaps_beep) == 0 ) } {
 	    caps "none"
 	}
     }
@@ -378,7 +368,7 @@
 	set tts(capitalize) 0
 	caps "tone"
     } else {
-	if { [ $tts(split_caps) == 0 ] && [ $tts(capitalize) == 0 ] } {
+	if { ( $tts(split_caps) == 0 ) && ( $tts(capitalize) == 0 ) } {
 	    caps "none"
 	}
     }
@@ -397,7 +387,7 @@
 proc r {rate} {
     global queue  tts
 
-    set queue($tts(q_tail)) [list s  "<prosody rate=\"[convert_speech_rate $rate]\">"]
+    set queue($tts(q_tail)) [list r  $rate]
     incr tts(q_tail)
     return ""
 }
@@ -442,11 +432,10 @@
 
     set tts(talking?) 1
     set tts(not_stopped) 1
-    set r $tts(speech_rate)
     set length [queue_length]
     set la $langcode(current)
 
-    set prefix "<voice xml:lang=\"$la\" gender=\"male\" variant=\"1\"><prosody rate=\"[convert_speech_rate $r]\">"
+    set prefix "<voice xml:lang=\"$la\" gender=\"male\" variant=\"1\">"
     loop index 0 $length {
 
         set event   [queue_remove]
@@ -470,6 +459,11 @@
                     eval beep $event
                 }
             }
+            r {
+
+# The first argument to setRate is ignored.
+                setRate 0 [lindex  $event 1]
+            }
         }
         if {$tts(talking?) == 0} {break;} 
     }


If you have questions about this archive or had problems using it, please send mail to:

priestdo@xxxxxxxxxxx No Soliciting!

Emacspeak List Archive | 2007 | 2006 | 2005 | 2004 | 2003 | 2002 | 2001 | 2000 | 1999 | 1998 | Pre 1998

Emacspeak Files | Emacspeak Blog