MRCPSynth()
MRCPSynth() is a dialplan application provided by the res_unimrcp.so module (see Developing Speech Applications on Asterisk for more information) that performs text-to-speech (TTS) synthesis of plaintext or SSML-formatted documents.
Application
MRCPSynth(text,options)Parameters
text
Text for the TTS engine to read to the caller. Valid inputs are plaintext specified inline, SSML specified inline, or a path/URI to an SSML document. See the Introduction to SSML for more information about working with SSML.
options
Options control details about the synthesis. Valid options are:
- l — Language to use (e.g. "en-GB", "en-US", "en-AU").
- v — Voice name to use (e.g. "Lindsey", "Chris").
- g — Voice gender to use (e.g. "male", "female").
- p — Profile to use, as specified in the mrcp.conf file.
- i — Digits to allow the TTS to be interrupted with. Specify "any" to allow any digit to interrupt.
- f — Filename on disk to store audio to. Audio is not stored if not specified or empty.
- epe — Exit on a play error.
- pv — Prosody volume (silent/x-soft/soft/medium/loud/x-loud/default).
- pr — Prosody rate (x-slow/slow/medium/fast/x-fast/default).
You are not required to supply any options. Multiple options can be provided by joining them with an ampersand, e.g. l=en-US&g=female
Remarks
Because dialplan applications cannot take more than 1024 characters as arguments, any long text to be synthesized should be specified as an SSML document via external reference (see examples below). You are limited to about 10 seconds of synthesized text with any MRCPSynth() call.
If you supply SSML inline, be sure to escape all quotation marks and commas with backslashes.
Parameters such as language or voice specified in an SSML document will take precedence over any options set when invoking MRCPSynth(). The recommendation is to use SSML for this kind of control.
Example Uses
Hello World (plain text)
exten => 1,1,MRCPSynth(Hello world)Set Language via Option
exten => 1,1,MRCPSynth(Bonjour monde,l=fr-FR)Multiple Options
exten => 1,1,MRCPSynth(Bonjour monde,l=fr-FR&i=any)SSML Referenced via HTTP
exten => 1,1,MRCPSynth(http://mySSMLServer/ssml/helloworld.ssml)Inline SSML
exten => 1,1,MRCPSynth(<?xml version=\"1.0\"?><speak version=\"1.0\"><voice name=\"Lindsey\">My name is Lindsey.</voice><voice name=\"Chris\">And I'm Chris</voice><voice xml:lang=\"en-GB\">And I'm British</voice></speak>,p=default)