Platform SDK: Agent

Accessing Speech Services

Although Microsoft Agent's services include support for speech input, a compatible command-and-control speech recognition engine must be installed to access Agent's speech input services. Similarly, if you want to use Microsoft Agent's speech services to support synthesized speech output for a character, you must install a compatible text-to-speech (TTS) speech engine for your character.

To enable speech input support in your application, define a Command object and set its Voice property. Agent will automatically load speech services, so that when the user presses the Listening key or you call Listen, the speech recognition engine will be loaded. By default the character's LanguageID will determine which engine is loaded. Agent attempts to load the first engine that the Microsoft Speech API (SAPI) returns as matching this language. Use SRModeID if you want to load a specific engine.

To enable text-to-speech output, use the Speak method. Agent will automatically attempt to load an engine that matches the character's LanguageID. If the character's definition includes a specific TTS engine mode ID and that engine is available and matches the character's LanguageID, Agent loads that engine for the character. If it is not, it loads the first TTS engine that SAPI returns as matching the character's language setting. You can also use the TTSModeID to load a specific engine.

Typically, Agent loads speech recognition when the Listening mode is initiated and a text-to-speech engine when Speak is first called. However, if you want to preload the speech engine, you query the properties related to the speech interfaces. For example, querying SRModeID or TTSModeID will attempt to load that type of engine.

Because Microsoft Agent's speech services are based on the Microsoft Speech API, you can use any engines that support the required speech interfaces. Further information on the availability and use of speech recognition and text-to-speech engines at the Microsoft Agent Download page