Synthesizer SPEAK
The SPEAK method, sent from the client to the server, provides the synthesizer resource with the text to render and initiates speech synthesis and streaming. A SPEAK request can carry voice and prosody header fields that shape the synthesized voice, alongside the marked-up text to be spoken. Voice and prosody settings expressed inside the speech markup take precedence over the header fields and over any defaults set by a previous SET-PARAMS request.
Voice parameters resolve across three levels of scope, highest precedence first: values inside the speech markup; values in the SPEAK request’s header fields (which apply to that request only); and the session defaults set with SET-PARAMS (which apply for the rest of the session).
If the resource is idle and the request is accepted for processing, the server responds with a success status and a request-state of IN-PROGRESS.
If the resource is already in the speaking or paused state (mid-way through a previous SPEAK), the server responds with success and a request-state of PENDING: the new request is queued and processed once the active SPEAK completes.
SPEAK is the only synthesizer request that can return a request-state of IN-PROGRESS or PENDING. When synthesis of the supplied text finishes, the resource issues a SPEAK-COMPLETE event carrying the SPEAK request-id and a request-state of COMPLETE.
MRCPv1 example
A SPEAK request with SSML content, the IN-PROGRESS acknowledgement, and the final SPEAK-COMPLETE event:
| C->S: SPEAK 543257 MRCP/1.0 Voice-gender:female Prosody-volume:medium Content-Type:application/synthesis+ssml Content-Length:104 <?xml version="1.0"?> <speak> <paragraph> <sentence>You have 4 new messages.</sentence> <sentence>The first is from <say-as type="name">Stephanie Williams</say-as> and arrived at <break/> <say-as type="time">3:45pm</say-as>.</sentence> <sentence>The subject is <prosody rate="0.8">ski trip</prosody></sentence> </paragraph> </speak> S->C: MRCP/1.0 543257 200 IN-PROGRESS S->C: SPEAK-COMPLETE 543257 COMPLETE MRCP/1.0 Completion-Cause:000 normal |
MRCPv2 example
The same exchange in MRCPv2, with the Channel-Identifier and Speech-Marker headers:
| C->S: MRCP/2.0 ... SPEAK 543257 Channel-Identifier:32AECB23433802@speechsynth Voice-gender:female Prosody-volume:medium Content-Type:application/ssml+xml Content-Length:... <?xml version="1.0"?> <speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/10/synthesis http://www.w3.org/TR/speech-synthesis/synthesis.xsd" xml:lang="en-US"> <p> <s>You have 4 new messages.</s> <s>The first is from Stephanie Williams and arrived at <break/> <say-as interpret-as="vxml:time">0342p</say-as>. </s> <s>The subject is <prosody rate="0.8">ski trip</prosody> </s> </p> </speak> S->C: MRCP/2.0 ... 543257 200 IN-PROGRESS Channel-Identifier:32AECB23433802@speechsynth Speech-Marker:timestamp=857206027059 S->C: MRCP/2.0 ... SPEAK-COMPLETE 543257 COMPLETE Channel-Identifier:32AECB23433802@speechsynth Completion-Cause:000 normal Speech-Marker:timestamp=857206027059 |
Language selection with plain-text synthesis
For TTS over MRCP, the SSML Content-Type shown above is preferable: it gives far greater control over pronunciation, phrasing, and voice selection. Sometimes, however, plain text is required—by preference, or because the platform in use does not support SSML—and it becomes important to control the synthesis language.
The platform supports the Speech-Language header for plain-text syntheses (Content-Type: text/plain), as shown below:
MRCPv1 plain-text example (British English)
| C->S: SPEAK 543257 MRCP/1.0 Voice-gender:female Prosody-volume:medium Content-Type:text/plain Speech-Language:en-GB Content-Length:45 Capacity Private Cloud TTS is the Bee's Knees S->C: MRCP/1.0 543257 200 IN-PROGRESS S->C: SPEAK-COMPLETE 543257 COMPLETE MRCP/1.0 Completion-Cause:000 normal |
MRCPv2 plain-text example (British English)
| C->S: MRCP/2.0 ... SPEAK 543257 Channel-Identifier:32AECB23433802@speechsynth Voice-gender:female Prosody-volume:medium Content-Type:text/plain Speech-Language:en-GB Content-Length:45 Capacity Private Cloud TTS is the Bee's Knees S->C: MRCP/2.0 ... 543257 200 IN-PROGRESS Channel-Identifier:32AECB23433802@speechsynth Speech-Marker:timestamp=857206027059 S->C: MRCP/2.0 ... SPEAK-COMPLETE 543257 COMPLETE Channel-Identifier:32AECB23433802@speechsynth Completion-Cause:000 normal Speech-Marker:timestamp=857206027059 |
Note that a Speech-Language header is ignored when the Content-Type is SSML (application/ssml+xml): the language specifier inside the SSML is authoritative and is used instead. The Speech-Language header therefore applies only to Content-Type: text/plain requests.
