Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.
Control Voice Attributes (Microsoft.Speech)
A computer may have multiple synthesizer voices installed that represent various combinations of language, age, and gender. You can select the voice to use with methods on the SpeechSynthesizer object. In addition, you can embed commands in prompts using methods on the PromptBuilder object that change the voice that the synthesizer uses while it is processing prompts.
A voice is an installed Runtime Language for speech synthesis (TTS, or text-to-speech). The Microsoft Speech Platform Runtime 11 and Microsoft Speech Platform SDK 11 do not include any Runtime Languages for speech synthesis. You must download and install a Runtime Language for each language in which you want to generate synthesized speech. A Runtime Language includes the language model, acoustic model, and other data necessary to provision a speech engine to perform speech synthesis in a particular language. See InstalledVoice for more information.
Select a Voice
When you create a new SpeechSynthesizer object, it uses the default system voice. To select one of the other installed voices, use the SelectVoice(String) or SelectVoiceByHints() methods. Using the SelectVoiceByHints() methods, you can specify characteristics of the voice you want to select, such as language-culture, gender, and age.
Change the Voice
To change the voice in use by the synthesizer, call the StartVoice(String) method, providing the name of the voice in the call. For English (U.S.), the name of the default synthesis voice is "Microsoft Server Speech Text to Speech Voice (en-US, Helen)". When the voice is no longer needed, call the EndVoice() method. After EndVoice() returns, the voice is reset to the voice in use before the call to StartVoice(String).
An application that has registered a handler for the VoiceChange event can determine the details of the voice change by inspecting the handler’s VoiceChangeEventArgs argument. For more information, see Use Speech Synthesis Events (Microsoft.Speech).
Change to a voice of another culture
To change to a synthesizer voice of a different culture, call the StartVoice(CultureInfo) method, passing an initialized CultureInfo instance that represents the desired culture. To generate speech using the language specified in the CultureInfo argument, a Runtime Language that supports that language-country code must be installed.
Change to a voice of another gender or age
There are three methods that can be used to change the synthesizer’s gender, age, or both.
To change the voice’s gender and age, call the StartVoice(VoiceGender, VoiceAge) method, passing values from the VoiceGender and VoiceAge enumerations in the first and second parameters. To change only the age, pass the current gender value and the new age value.
To change the voice’s gender and age and to specify a preferred voice when more than one voice matches the gender and age parameters, call the StartVoice(VoiceGender, VoiceAge, Int32) method. Pass in the gender and age and an integer that specifies the preferred voice among those that match the gender and age parameters. This parameter represents the variant attribute that is defined in the Speech Synthesis Markup Language 1.0 specification for the voice element.