Partajați prin


SpeechSynthesizer.SelectVoiceByHints Method

Definition

Selects a voice with specific characteristics.

Overloads

SelectVoiceByHints(VoiceGender)

Selects a voice with a specific gender.

SelectVoiceByHints(VoiceGender, VoiceAge)

Selects a voice with a specific gender and age.

SelectVoiceByHints(VoiceGender, VoiceAge, Int32)

Selects a voice with a specific gender and age, based on the position in which the voices are ordered.

SelectVoiceByHints(VoiceGender, VoiceAge, Int32, CultureInfo)

Selects a voice with a specific gender, age, and locale, based on the position in which the voices are ordered.

Remarks

Use the GetInstalledVoices method and VoiceInfo class to obtain the names of installed text-to-speech (TTS) voices that you can select. The SpeechSynthesizer object selects the first installed voice that matches the specified characteristics.

When an application calls GetInstalledVoices, the method verifies that each of the voices it finds in the registry meets certain minimum criteria. For any voice that fails verification, GetInstalledVoices sets its Enabled property to False. An application cannot select a voice whose Enabled property is False. Typically, applications will not set a voice's Enabled property.

To select a voice by name, use the SelectVoice method

SelectVoiceByHints(VoiceGender)

Source:
SpeechSynthesizer.cs
Source:
SpeechSynthesizer.cs
Source:
SpeechSynthesizer.cs

Selects a voice with a specific gender.

public:
 void SelectVoiceByHints(System::Speech::Synthesis::VoiceGender gender);
public void SelectVoiceByHints (System.Speech.Synthesis.VoiceGender gender);
member this.SelectVoiceByHints : System.Speech.Synthesis.VoiceGender -> unit
Public Sub SelectVoiceByHints (gender As VoiceGender)

Parameters

gender
VoiceGender

The gender of the voice to select.

Remarks

Use the GetInstalledVoices method and VoiceInfo class to obtain the names of installed text-to-speech (TTS) voices that you can select. The SpeechSynthesizer object selects the first installed voice whose Gender property matches the gender parameter.

When an application calls GetInstalledVoices, the method verifies that each of the voices it finds in the registry meets certain minimum criteria. For any voice that fails verification, GetInstalledVoices sets its Enabled property to False. An application cannot select a voice whose Enabled property is False. Typically, applications will not set a voice's Enabled property.

To select a voice based on other characteristics, see the other SelectVoiceByHints methods.

To select a voice by name, use the SelectVoice method.

See also

Applies to

SelectVoiceByHints(VoiceGender, VoiceAge)

Source:
SpeechSynthesizer.cs
Source:
SpeechSynthesizer.cs
Source:
SpeechSynthesizer.cs

Selects a voice with a specific gender and age.

public:
 void SelectVoiceByHints(System::Speech::Synthesis::VoiceGender gender, System::Speech::Synthesis::VoiceAge age);
public void SelectVoiceByHints (System.Speech.Synthesis.VoiceGender gender, System.Speech.Synthesis.VoiceAge age);
member this.SelectVoiceByHints : System.Speech.Synthesis.VoiceGender * System.Speech.Synthesis.VoiceAge -> unit
Public Sub SelectVoiceByHints (gender As VoiceGender, age As VoiceAge)

Parameters

gender
VoiceGender

The gender of the voice to select.

age
VoiceAge

The age of the voice to select.

Remarks

Use the GetInstalledVoices method and VoiceInfo class to obtain the names of installed text-to-speech (TTS) voices that you can select. The SpeechSynthesizer object selects the first installed voice whose Gender and Age properties match the gender and age parameters.

When an application calls GetInstalledVoices, the method verifies that each of the voices it finds in the registry meets certain minimum criteria. For any voice that fails verification, GetInstalledVoices sets its Enabled property to False. An application cannot select a voice whose Enabled property is False. Typically, applications will not set a voice's Enabled property.

To select a voice based on other characteristics, see the other SelectVoiceByHints methods.

To select a voice by name, use the SelectVoice method.

See also

Applies to

SelectVoiceByHints(VoiceGender, VoiceAge, Int32)

Source:
SpeechSynthesizer.cs
Source:
SpeechSynthesizer.cs
Source:
SpeechSynthesizer.cs

Selects a voice with a specific gender and age, based on the position in which the voices are ordered.

public:
 void SelectVoiceByHints(System::Speech::Synthesis::VoiceGender gender, System::Speech::Synthesis::VoiceAge age, int voiceAlternate);
public void SelectVoiceByHints (System.Speech.Synthesis.VoiceGender gender, System.Speech.Synthesis.VoiceAge age, int voiceAlternate);
member this.SelectVoiceByHints : System.Speech.Synthesis.VoiceGender * System.Speech.Synthesis.VoiceAge * int -> unit
Public Sub SelectVoiceByHints (gender As VoiceGender, age As VoiceAge, voiceAlternate As Integer)

Parameters

gender
VoiceGender

The gender of the voice to select.

age
VoiceAge

The age of the voice to select.

voiceAlternate
Int32

The position of the voice to select.

Remarks

Use the GetInstalledVoices method and VoiceInfo class to obtain the names of installed text-to-speech (TTS) voices that you can select. The SpeechSynthesizer object finds installed voices whose Gender and Age properties match the gender and age parameters. The SpeechSynthesizer counts the matches it finds, and returns the voice when the count equals the voiceAlternate parameter.

When an application calls GetInstalledVoices, the method verifies that each of the voices it finds in the registry meets certain minimum criteria. For any voice that fails verification, GetInstalledVoices sets its Enabled property to False. An application cannot select a voice whose Enabled property is False. Typically, applications will not set a voice's Enabled property.

To select a voice based on other characteristics, see the other SelectVoiceByHints overloads.

To select a voice by name, use the SelectVoice method.

See also

Applies to

SelectVoiceByHints(VoiceGender, VoiceAge, Int32, CultureInfo)

Source:
SpeechSynthesizer.cs
Source:
SpeechSynthesizer.cs
Source:
SpeechSynthesizer.cs

Selects a voice with a specific gender, age, and locale, based on the position in which the voices are ordered.

public:
 void SelectVoiceByHints(System::Speech::Synthesis::VoiceGender gender, System::Speech::Synthesis::VoiceAge age, int voiceAlternate, System::Globalization::CultureInfo ^ culture);
public void SelectVoiceByHints (System.Speech.Synthesis.VoiceGender gender, System.Speech.Synthesis.VoiceAge age, int voiceAlternate, System.Globalization.CultureInfo culture);
member this.SelectVoiceByHints : System.Speech.Synthesis.VoiceGender * System.Speech.Synthesis.VoiceAge * int * System.Globalization.CultureInfo -> unit
Public Sub SelectVoiceByHints (gender As VoiceGender, age As VoiceAge, voiceAlternate As Integer, culture As CultureInfo)

Parameters

gender
VoiceGender

The gender of the voice to select.

age
VoiceAge

The age of the voice to select.

voiceAlternate
Int32

The position of the voice to select.

culture
CultureInfo

The locale of the voice to select.

Remarks

The SpeechSynthesizer object finds voices whose Gender, Age, and Culture properties match the gender, age, and culture parameters. The SpeechSynthesizer counts the matches it finds, and returns the voice when the count equals the voiceAlternate parameter.

Microsoft Windows and the System.Speech API accept all valid language-country codes. To perform text-to-speech using the language specified in the culture parameter, a speech synthesis engine that supports that language-country code must be installed. The speech synthesis engines that shipped with Microsoft Windows 7 work with the following language-country codes:

  • en-US. English (United States)

  • zh-CN. Chinese (China)

  • zh-TW. Chinese (Taiwan)

Two-letter language codes such as "en" are also permitted.

When an application calls GetInstalledVoices, the method verifies that each of the voices it finds in the registry meets certain minimum criteria. For any voice that fails verification, GetInstalledVoices sets its Enabled property to False. An application cannot select a voice whose Enabled property is False. Typically, applications will not set a voice's Enabled property.

To select a voice based on other characteristics, see the other SelectVoiceByHints overloads.

To select a voice by name, use the SelectVoice method.

See also

Applies to