Applications define synthesizer speak lists that the server uses when the application sends multiple sentences of text to a synthesizer at one time. A speak list contains entries of a single data type or of different data types.
When the speak list contains different data types, the synthesizer uses multiple-part speak mode in accordance with MRCP 7.5.1 to perform speech synthesis. For information about multiple-part speak mode support for a specific synthesizer, refer to the speech vendor documentation.
Applications invoke saiInitSpeakList, saiAddSpeakItem, and saiSpeakSynthesizer when requesting speech synthesis one sentence at a time.
The following example shows how an application sends multiple sentences of text in various forms to a synthesizer:
#define SAI_TEST_MAX_GRAMMAR_LIST_SIZE 0x1000
char speakRuleList[SAI_TEST_MAX_GRAMMAR_LIST_SIZE];
char textToSpeak[] = “This is the SAI demo program”;
char xmlToSpeak[] =
“<?xml version="1.0"?>”
“ <speak>\n “
“ <paragraph>\n”
“ <sentence>You have 4 new messages.</sentence>\n”
“ <sentence>The first is from <say-as>\n”
“ type="name">Stephanie Williams</say-as>\n”
“ and arrived at <break/>\n”
“ <say-as type="time">3:45pm</say-as>.</sentence>\n”
“ <sentence>The subject is <prosody>\n”
“ rate="-20%">ski trip</prosody></sentence>\n”
“ </paragraph>\n”;
“ </speak>\n”
char uriToSpeak[] = http://www.nmss.com/TTS-Introduction.sml;
rc = saiInitSpeakList(speakRuleList, SAI_TEST_MAX_GRAMMAR_LIST_SIZE) );
if ( rc == SUCCESS )
{
//
// Add speak rules to the datalist.
//
rc = saiAddSpeakItem(speakRuleList, SAI_SPEAK_DATA_TYPE_PLAIN_TEXT, textToSpeak);
rc = saiAddSpeakItem(speakRuleList, SAI_SPEAK_DATA_TYPE_XML, xmlToSpeak);
rc = saiAddSpeakItem(speakRuleList, SAI_SPEAK_DATA_TYPE_URL, uriToSpeak);
rc = saiSpeakSynthesizer( synthHd, SAI_SPEAK_DATA_TYPE_DATA_LIST, speakRuleList,
NULL );
}