API Documentation (Beta)

speak

Description

int speak ( string $text [, int $voice_option [, int $barge_in]] )

speak ouputs the synthesized text-to-speech content of text. This should be used only when you want to speak using a different voice option than the default one otherwise inbuilt functions like echo, print should be used. Default options can be changes using setvoiceoption.

Parameters

text

The string that needs to be processed and output

voice_option

This specifies the voice that should be used to render the audio output. Currently supported options include MALE or FEMALE.

barge_in

This controls whether or not the caller will be able to interrupt the speech output with a DTMF keypress or voice utterance.By default, this value is set to 0. i.e. it forces the caller to listen to entire text before being allowed to give input.

If you wish to enable it, following options can be set.

Pre-defined barge_in() bit options
name description
Bit 0 When this bit is set, the caller can interrupt the speech output.
Bit 1 When set, it specifies that DTMF keypresses can be used for interruption
Bit 2 When set, it specifies that Voice utterance can be used for interruption.

Return Values

Returns user input.