SpeechSynthesizer Class (Windows.Media.SpeechSynthesis)
发布时间:2026-09-18 | 浏览:1
Access to this page requires authorization. You can try signing in or changing directories .
Access to this page requires authorization. You can try changing directories .
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides access to the functionality of an installed speech synthesis engine (voice) for Text-to-speech (TTS) services.
Windows requirements
The following example shows how to generate a speech audio stream from a basic text string.
This example shows how to generate a speech audio stream from an SSML string, which includes some modulation elements that control the pitch, speaking rate, and volume of the speech output.
Only Microsoft-signed voices installed on the system can be used to generate speech.
Windows includes various Microsoft-signed voices that can be used for a number of languages. Each voice generates synthesized speech in a single language, as spoken in a specific country/region.
By default, a new SpeechSynthesizer object uses the current system voice (call DefaultVoice to find out what the default voice is).
To specify any of the other speech synthesis (text-to-speech) voices installed on the user's system, use the Voice method (to find out which voices are installed on the system, call AllVoices ).
If you don't specify a language, the voice that most closely corresponds to the language selected in the Language control panel is loaded.
Use a SpeechSynthesizer object to:
Generate speech from plain text using SynthesizeTextToStreamAsync , or Speech Synthesis Markup Language (SSML) Version 1.1 using SynthesizeSsmlToStreamAsync (
The generated audio stream is played through a MediaElement object), which lets you manage all media playback.
Control the speech output with the various SpeechSynthesizerOptions settings exposed through SpeechSynthesizer.Options .
Version history
Initializes a new instance of a SpeechSynthesizer object.
Gets a collection of all installed speech synthesis engines (voices).
Gets the default speech synthesis engine (voice).
Gets a reference to the collection of options that can be set on the SpeechSynthesizer object.
Gets or sets the speech synthesis engine (voice).
Closes the SpeechSynthesizer and releases system resources.
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Asynchronously generate and control speech output from a Speech Synthesis Markup Language (SSML) Version 1.1 string.
Asynchronously generate speech output from a string.
Asynchronously attempts to set the voice used for speech synthesis on an IoT device.
This method is available only in Embedded mode .
Windows.Media.SpeechSynthesis
VoiceInformation
Speech interactions
Speech recognition and speech synthesis sample
Holographic voice input sample
Was this page helpful?
Need help with this topic?
Want to try using Ask Learn to clarify or guide you through this topic?