TTS
About
Text-To-Speech general Information.Freeswitch currently supports several TTS options.
- mod_unimrcp - TTS using MRCP protocol
- mod_cepstral - Commercial high-quality [Cepstral] voices & Text to Speech engine.
- mod_flite - An FOSS option, Flite / Festival Lite. [old wiki]
- mod_tts_commandline - Run a command line and play the output file.
The complete list of TTS modules is available on the modules list page.
Click here to expand Table of Contents
- 1 Javascript Implementation
- 2 Via mod_shout using online TTS
- 2.1 Bing Translate
- 2.2 Google Translate
Javascript Implementation
Via mod_shout using online TTS
Using mod_shout allows you to stream audio from an URL, this allows you to utilize high quality online TTS services by writing out custom GET requests. Since an Internet transfer occurs on each TTS transaction this approach might not be desirable in a production environment.
Bing Translate
Register for an API Key appid and replace the 'YOUR-KEY-HERE' in the GET url below. For more information, see here.
IVR Example
<include> <!-- demo IVR, Main Menu --> <!-- Other "flite" voices slt (female voice - best), rms (male voice), awb (male voice), kal (male voice) --> <menu name="ivr_danols_after_hours" tts-engine="flite" tts-voice="slt" max-failures="3" max-timeouts="3" confirm-macro="" confirm-key="" confirm-attempts="3" timeout="10000" inter-digit-timeout="2000" digit-len="1" <!-- say using online TTS --> greet-long="shout://api.microsofttranslator.com/V2/Http.svc/Speak?language=en&format=audio/mp3&options=MaxQuality&appid=YOUR-KEY-HERE&text=Thank+you+for+calling+Danols." <!-- or say using built in flite --> greet-short="say:Thank+you+for+calling+Danols." invalid-sound="say:Invalid selection" exit-sound="say:Goodby and thank you for calling Danols.">
<!-- The following are the definitions for the digits the user dials --> <entry action="menu-exec-app" digits="1" param="transfer 1000 XML default"/> </menu> </include>
Google Translate
You probably need to agree with Google API TOS, located at..? Please note google will fail to convert if the input text is to long so test url in browser first; Bing appears to be more lenient in this regard.
<extension name="Free_Google_Text_To_Speech"> <condition field="destination_number" expression="^2115$"> <action application="answer" data=""/> <action application="playback" data="shout://translate.google.com/translate_tts?tl=en&q=Buy+Cheap+dids+at+www+dot+voice+network+dot+see+eh"/> </condition> </extension>
Comments:
According to [1], google has done some changes. The link presented in [1] works for me(gets played back by freeswitch) at this point in time. However, each text input to be played is matched with that "tk" value.LATER EDIT 1:After some more searching I've found the kind of links that work:shout://translate.google.com/translate_tts?ie=UTF-8&total=1&idx=0&textlen=32&client=tw-ob&q=Test+this&tl=En-gbLATER EDIT 2:Bing appId is deprecated, as stated in [2]. One should use the azure clientID and clientSecret to query for a token, used in the body of the request. [1] http://stackoverflow.com/questions/32053442/google-translate-tts-api-blocked[2] http://stackoverflow.com/questions/10196487/bing-appid-is-invalid Posted by stefan.mititelu at Aug 05, 2016 06:41 |
---|