Note

Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.

SpeechSynthesizer.SpeakAsync Method

Include Protected Members
Include Inherited Members

Generates speech output asynchronously from a string, a Prompt object, or a PromptBuilder object.

Overload List

  Name Description
Public method SpeakAsync(String) Asynchronously speaks the contents of a string.
Public method SpeakAsync(Prompt) Asynchronously speaks the contents of a Prompt object.
Public method SpeakAsync(PromptBuilder) Asynchronously speaks the contents of a PromptBuilder object.

Top

Remarks

The SpeakAsync() methods generate speech asynchronously. The methods return immediately without waiting for the content of the SpeakAsync() object to finish speaking. Use SpeakAsync() if your application needs to perform tasks while speaking, for example highlight text, paint animation, monitor controls, or other tasks. Because the SpeakAsync() calls are asynchronous, you will typically play the output in a handler for the SpeakCompleted event. See the examples in this section.

During a call to a SpeakAsync() method, the SpeechSynthesizer can raise the following events:

  • StateChanged. Raised when the speaking state of the synthesizer changes.

  • SpeakStarted. Raised when the synthesizer begins generating speech.

  • SpeakProgress. Raised each time the synthesizer completes speaking a word.

  • BookmarkReached. Raised when the synthesizer encounters a bookmark in a prompt.

  • VoiceChange. Raised when the speaking voice for the synthesizer changes.

  • SpeakCompleted. Raised when the synthesizer finishes a SpeakAsync() operation.

If your application does not need to perform tasks while speaking, you can use the Speak() methods or the SpeakSsml(String) method to generate speech synchronously.

See Also

Reference

SpeechSynthesizer Class

SpeechSynthesizer Members

Microsoft.Speech.Synthesis Namespace