Provides access to the functionality of an installed a speech synthesis engine.
Inheritance Hierarchy
Namespace:
Microsoft.Speech.Synthesis
Assembly:
Microsoft.Speech (in Microsoft.Speech.dll)
Syntax
Visual Basic (Declaration) |
---|
Public NotInheritable Class SpeechSynthesizer _ Implements IDisposable |
Visual Basic (Usage) |
---|
Dim instance As SpeechSynthesizer |
C# |
---|
public sealed class SpeechSynthesizer : IDisposable |
Remarks
When you create a new SpeechSynthesizer object, it uses the default system voice. To configure the SpeechSynthesizer to use one of the installed speech synthesis (text-to-speech) voices, use the SelectVoice or SelectVoiceByHints method. To get information about which voices are installed, use the GetInstalledVoices method and the VoiceInfo class.
The SpeechSynthesizer can use one or more lexicons to guide its pronunciation of words. To add or remove lexicons, use the AddLexicon and RemoveLexicon methods.
This class also provides control over the following aspects of speech synthesis:
To configure the output for the SpeechSynthesizer object, use the SetOutputToAudioStream, SetOutputToDefaultAudioDevice, SetOutputToNull, and SetOutputToWaveFile methods.
To generate speech, use the Speak, SpeakAsync, SpeakSsml, or SpeakSsmlAsync method. The SpeechSynthesizer can produce speech from text, a Prompt or PromptBuilder object, or from Speech Synthesis Markup Language (SSML) Version 1.0.
To pause and resume speech synthesis, use the Pause and Resume methods.
To add or remove lexicons, use the AddLexicon and RemoveLexicon methods. The SpeechSynthesizer can use one or more lexicons to guide its pronunciation of words.
To modify the delivery of speech output, use the Rate and Volume properties.
The SpeechSynthesizer raises events when it encounters certain features in prompts: (BookmarkReached and SpeakProgress). It also raises events that report on the start (SpeakStarted) and end (SpeakCompleted) of speak operations and on the change of the speaking voice (VoiceChange).
Note |
---|
Always call Dispose()()()() before you release your last reference to the SpeechSynthesizer. Otherwise, the resources it is using will not be freed until the garbage collector calls the SpeechSynthesizer object's Finalize()()()() method. |