PromptBuilder.StartVoice 方法

定义

指示合成器更改 PromptBuilder 对象中的语音。Instructs the synthesizer to change the voice in a PromptBuilder object.

重载

StartVoice(VoiceGender, VoiceAge)

指示合成器更改 PromptBuilder 对象中的语音并指定新语音的性别和年龄。Instructs the synthesizer to change the voice in the PromptBuilder object and specifies the gender and the age of the new voice.

StartVoice(String)

指示合成器更改 PromptBuilder 对象中的语音并指定要使用的语音的名称。Instructs the synthesizer to change the voice in the PromptBuilder object and specifies the name of the voice to use.

StartVoice(VoiceGender, VoiceAge, Int32)

指示合成器更改 PromptBuilder 对象中的语音并指定其性别、年龄和与指定的性别和年龄匹配的首选语音。Instructs the synthesizer to change the voice in the PromptBuilder object and specifies its gender, age, and a preferred voice that matches the specified gender and age.

StartVoice(VoiceGender)

指示合成器更改 PromptBuilder 对象中的语音并指定要使用的语音的性别。Instructs the synthesizer to change the voice in the PromptBuilder object and specifies the gender of the voice to use.

StartVoice(CultureInfo)

指示合成器更改 PromptBuilder 对象中的语音并指定要使用的语音的区域性。Instructs the synthesizer to change the voice in the PromptBuilder object and specifies the culture of the voice to use.

StartVoice(VoiceInfo)

指示合成器更改 PromptBuilder 对象中的语音并为新的语音指定条件。Instructs the synthesizer to change the voice in the PromptBuilder object and specifies criteria for the new voice.

注解

语音表示已安装 TTS 引擎。A voice represents an installed TTS engine. 使用方法和VoiceInfo类获取已安装的文本到语音转换 (TTS) 语音的名称和属性, 您可以选择这些声音。 GetInstalledVoicesUse the GetInstalledVoices methods and VoiceInfo class to obtain the names and attributes of installed text-to-speech (TTS) voices that you can select.

当应用程序调用GetInstalledVoices时, 该方法会验证它在注册表中找到的每个声音是否满足某些最小标准。When an application calls GetInstalledVoices, the method verifies that each of the voices it finds in the registry meets certain minimum criteria. 对于验证失败的任何语音, GetInstalledVoices将其Enabled属性设置False为。For any voice that fails verification, GetInstalledVoices sets its Enabled property to False. 应用程序不能对其StartVoice Enabled属性为False的语音调用任何方法。An application cannot call any of the StartVoice methods on a voice whose Enabled property is False. 通常, 应用程序不会设置语音的Enabled属性。Typically, applications will not set a voice's Enabled property.

StartVoice(VoiceGender, VoiceAge)

指示合成器更改 PromptBuilder 对象中的语音并指定新语音的性别和年龄。Instructs the synthesizer to change the voice in the PromptBuilder object and specifies the gender and the age of the new voice.

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

参数

gender
VoiceGender

使用新的语音的性别。The gender of the new voice to use.

age
VoiceAge

要使用的语音的年龄。The age of the voice to use.

注解

使用方法和VoiceInfo类获取已安装的文本到语音转换 (TTS) 语音的名称和属性, 您可以选择这些声音。 GetInstalledVoicesUse the GetInstalledVoices methods and VoiceInfo class to obtain the names and attributes of installed text-to-speech (TTS) voices that you can select.

使用StartVoice callEndVoice指定的语音停止。To stop using the voice specified by StartVoice call EndVoice.

StartVoice(String)

指示合成器更改 PromptBuilder 对象中的语音并指定要使用的语音的名称。Instructs the synthesizer to change the voice in the PromptBuilder object and specifies the name of the voice to use.

public:
 void StartVoice(System::String ^ name);
public void StartVoice (string name);
member this.StartVoice : string -> unit
Public Sub StartVoice (name As String)

参数

name
String

要使用的语音的名称。The name of the voice to use.

注解

若要获取有关已安装的声音的信息, 请使用GetInstalledVoices其中一种方法。To get information about which voices are installed, use one of the GetInstalledVoices methods.

使用StartVoice callEndVoice指定的语音停止。To stop using the voice specified by StartVoice call EndVoice.

StartVoice(VoiceGender, VoiceAge, Int32)

指示合成器更改 PromptBuilder 对象中的语音并指定其性别、年龄和与指定的性别和年龄匹配的首选语音。Instructs the synthesizer to change the voice in the PromptBuilder object and specifies its gender, age, and a preferred voice that matches the specified gender and age.

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

参数

gender
VoiceGender

使用语音的性别。The gender of the voice to use.

age
VoiceAge

要使用的语音的年龄。The age of the voice to use.

voiceAlternate
Int32

当多个语音与 genderage 参数相匹配,指定首选语音的整数。An integer that specifies a preferred voice when more than one voice matches the gender and age parameters.

注解

语音合成引擎对为指定参数找到的匹配项进行计数, 并在计数等于voiceAlternate参数时返回声音。A speech synthesis engine counts the matches it finds for the specified parameters, and returns the voice when the count equals the voiceAlternate parameter.

使用方法和VoiceInfo类获取已安装的文本到语音转换 (TTS) 语音的名称和属性, 您可以选择这些声音。 GetInstalledVoicesUse the GetInstalledVoices methods and VoiceInfo class to obtain the names and attributes of installed text-to-speech (TTS) voices that you can select.

使用StartVoice callEndVoice指定的语音停止。To stop using the voice specified by StartVoice call EndVoice.

另请参阅

StartVoice(VoiceGender)

指示合成器更改 PromptBuilder 对象中的语音并指定要使用的语音的性别。Instructs the synthesizer to change the voice in the PromptBuilder object and specifies the gender of the voice to use.

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

参数

gender
VoiceGender

使用语音的性别。The gender of the voice to use.

注解

使用方法和VoiceInfo类获取已安装的文本到语音转换 (TTS) 语音的名称和属性, 您可以选择这些声音。 GetInstalledVoicesUse the GetInstalledVoices methods and VoiceInfo class to obtain the names and attributes of installed text-to-speech (TTS) voices that you can select.

使用StartVoice callEndVoice指定的语音停止。To stop using the voice specified by StartVoice call EndVoice.

StartVoice(CultureInfo)

指示合成器更改 PromptBuilder 对象中的语音并指定要使用的语音的区域性。Instructs the synthesizer to change the voice in the PromptBuilder object and specifies the culture of the voice to use.

public:
 void StartVoice(System::Globalization::CultureInfo ^ culture);
public void StartVoice (System.Globalization.CultureInfo culture);
member this.StartVoice : System.Globalization.CultureInfo -> unit
Public Sub StartVoice (culture As CultureInfo)

参数

culture
CultureInfo

提供有关特定区域性的信息,如语言、区域性的名称、写入系统、使用的日历和如何设置日期和排序字符串。Provides information about a specific culture, such as the language, the name of the culture, the writing system, the calendar used, and how to format dates and sort strings.

注解

culture 参数Culture可以不同于包含它的对象的属性。PromptBuilder StartVoiceThe culture parameter for StartVoice can be different than the Culture property of the PromptBuilder object that contains it. 当有效时, culture参数的值将Culture重写属性。While in effect, the value of the culture parameter will override the Culture property. 将尝试选择支持culture参数所指定语言的已安装语音, 以表达StartVoiceEndVoice所包含的内容。 SpeechSynthesizerThe SpeechSynthesizer will attempt to select an installed voice that supports the language specified by the culture parameter to speak the content enclosed by StartVoice and EndVoice. 如果找到具有指定区域性的语音, 将使用它。If a voice with the specified culture is found, it will be used. 如果找不到具有指定区域性的语音, 将使用默认语音。If a voice with the specified culture cannot be found, the default voice will be used. 若要停止使用由StartVoice指定的语音, 请调用。 EndVoiceTo stop using the voice specified by StartVoice, call EndVoice.

若要按culture参数所指定的语言正确地发音单词, 必须安装支持该语言的语音合成 (文字到语音转换或 TTS) 引擎。To correctly pronounce words in the language specified by the culture parameter, a speech synthesis (text-to-speech or TTS) engine that supports the language must be installed. 已安装的 TTS 引擎称为 "语音"。An installed TTS engine is called a voice. 若要获取有关针对特定区域性安装的声音的信息, 请使用GetInstalledVoices方法。To get information about which voices are installed for a specific culture, use the GetInstalledVoices method.

Microsoft Windows 和 Speech API 接受所有有效的语言-国家/地区代码作为的culture值。Microsoft Windows and the System.Speech API accept all valid language-country codes as values for culture. Windows 7 附带的 TTS 引擎支持以下语言-国家/地区代码:The TTS engines that shipped with Windows 7 support the following language-country codes:

  • en-us。en-US. 英语 (美国)English (United States)

  • zh-chs-CN。zh-CN. 中文 (中国)Chinese (China)

  • zh-chs-幼圆。zh-TW. 中文 (中国台湾)Chinese (Taiwan)

还允许使用两个字母的语言代码, 例如 "en"。Two-letter language codes such as "en" are also permitted.

StartVoice(VoiceInfo)

指示合成器更改 PromptBuilder 对象中的语音并为新的语音指定条件。Instructs the synthesizer to change the voice in the PromptBuilder object and specifies criteria for the new voice.

public:
 void StartVoice(System::Speech::Synthesis::VoiceInfo ^ voice);
public void StartVoice (System.Speech.Synthesis.VoiceInfo voice);
member this.StartVoice : System.Speech.Synthesis.VoiceInfo -> unit
Public Sub StartVoice (voice As VoiceInfo)

参数

voice
VoiceInfo

要使用的语音的条件。The criteria for the voice to use.

注解

使用方法和VoiceInfo类获取已安装的文本到语音转换 (TTS) 语音的名称和属性, 您可以选择这些声音。 GetInstalledVoicesUse the GetInstalledVoices methods and VoiceInfo class to obtain the names and attributes of installed text-to-speech (TTS) voices that you can select.

使用StartVoice callEndVoice指定的语音停止。To stop using the voice specified by StartVoice call EndVoice.

适用于