Speech synthesis: Difference between revisions

From Rosetta Code
Content added Content deleted
m (Duuuh! Template wrong)
m (tag into category)
Line 1: Line 1:
{{draft task|Temporal media}}<!-- this task to be in "Temporal media" category once ready. -->
{{draft task|Temporal media}}<!-- this task to be in "Temporal media" category once ready. -->[[Category:Speech synthesis]]
Render the text “<tt>This is an example of speech synthesis.</tt>” as speech.
Render the text “<tt>This is an example of speech synthesis.</tt>” as speech.



Revision as of 19:13, 24 April 2011

Speech synthesis is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

Render the text “This is an example of speech synthesis.” as speech.

Tcl

This just passes the string into the Festival system: <lang tcl>exec festival --tts << "This is an example of speech synthesis."</lang> Alternatively, on MacOS X, you'd use the system say program: <lang tcl>exec say << "This is an example of speech synthesis."</lang> Putting these together into a helper procedure, we get: <lang tcl>proc speak {msg} {

   global tcl_platform
   if {$tcl_platform(os) eq "Darwin"} {
       exec say << $msg
   } else {
       exec festival --tts << $msg
   }

} speak "This is an example of speech synthesis."</lang>