The <Speak> element reads the text as speech to the caller. It is very useful for dynamic text that cannot be pre-recorded. Variables can also be interpolated in the Speak text.

Element Attributes

Attribute Name Description Allowed Values Default Value
language Language to be used for output "ja" (Japanese) or "en" (English). Not required if parameter voice is passed ja
voice Voice to be used for output Any voice supported by Google TTS like en-US-Standard-C, ja-JP-Wavenet-B none
loop Number of time to repeat the output integer between 1 and 5 1

Examples

Example 1: Hi this is Basix

When a call is directed to the following XML document, the caller will hear "Hi this is Basix" spoken once

1
2
3
4
<?xml version="1.0" encoding="UTF-8" ?>
<Response>
	<Speak voice="en-US-Standard-C">Hi this is Basix.</Speak>
</Response>

Example 2: Hey, Hey, Hey

This XML document instructs Basix to say "Hey" thrice in a row.

1
2
3
4
<?xml version="1.0" encoding="UTF-8" ?>
<Response>
	<Speak voice="en-US-Standard-C" loop="3">Hey</Speak>
</Response>

Example 3: Variable interpolation

1
2
3
4
5
6
7
<?xml version="1.0" encoding="UTF-8" ?>
<Response>
	<GetDigits>
		<Speak voice="en-US-Standard-C">Please input some digits</Speak>
	</GetDigits>
	<Speak voice="en-US-Standard-C" loop="3">You dialed {{Digits}}</Speak>
</Response>