Speak Method

Description

Speaks the specified text for the specified character.

Syntax

agent.Characters ("CharacterID").Speak [Text] [, Url]

Part Description
Text Optional. A string that specifies what the character says.
Url Optional. A string expression specifying the specification for an audio file. The specification can be a file specification or URL.

Remarks

Although the Text and Url parameters are optional, one of them must be supplied. To use this method with a character configured to speak only in its word balloon or using a text-to-speech (TTS) engine, simply provide the Text parameter. Include a space between words to define appropriate word breaks in the word balloon, even for languages that do not traditionally include spaces.

You can also include vertical bar characters (|) in the Text parameter to designate alternative strings, so that the server randomly chooses a different string each time it processes the method.

Character support of TTS output is defined when the character is compiled using the Microsoft Agent Character Editor. To generate TTS output, a compatible TTS engine must already be installed before calling this method. For further information, see Accessing Speech Support for Microsoft Agent.

If you use recorded sound-file output for the character, specify the file's location in the Url parameter. However, if you are using the HTTP protocol to access character or animation data, use the Get method to load the animation before calling the Speak method. When doing so, you still use the Text parameter to specify the words that appear in the character's word balloon. However, if you specify a linguistically enhanced sound file (.LWV) for the Url parameter and do not specify text for the word balloon, the Text parameter uses the text stored in the file.

You can also vary parameters of the speech output with special tags that you include in the Text parameter. For more information, see Speech Output Tags. If you declare an object reference and set it to this method, it returns a Request object. In addition, if the file has not been loaded, the server sets the Request object's Status property to "failed" with an appropriate error code number.

The Speak method uses the last action played to determine which speaking animation to play. For example, if you preceded the Speak command with a Play "GestureRight", the server will play GestureRight and then the GestureRight speaking animation.

If you call Speak and the audio channel is busy, the character's audio output will not be heard, but the text will display in the word balloon.

NoteThe word balloon's Enabled property must also be True for text to display.

NoteIf you are using a character that you did not compile, check the balloon FontName and CharSet properties for the character to determine whether they are appropriate for your locale. You may need to set these values before using the Speak method to ensure appropriate text display within the word balloon.

--------------------------------------------------------