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. 使用 GetInstalledVoices 方法和 VoiceInfo 類別,取得您可以選取之已安裝文字轉換語音(TTS)語音的名稱和屬性。Use 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. 應用程式無法在 Enabled 屬性 False的語音上呼叫任何 StartVoice 方法。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.

備註

使用 GetInstalledVoices 方法和 VoiceInfo 類別,取得您可以選取之已安裝文字轉換語音(TTS)語音的名稱和屬性。Use the GetInstalledVoices methods and VoiceInfo class to obtain the names and attributes of installed text-to-speech (TTS) voices that you can select.

若要停止使用指定的語音 StartVoice 呼叫 EndVoiceTo 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 呼叫 EndVoiceTo 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.

使用 GetInstalledVoices 方法和 VoiceInfo 類別,取得您可以選取之已安裝文字轉換語音(TTS)語音的名稱和屬性。Use the GetInstalledVoices methods and VoiceInfo class to obtain the names and attributes of installed text-to-speech (TTS) voices that you can select.

若要停止使用指定的語音 StartVoice 呼叫 EndVoiceTo 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.

備註

使用 GetInstalledVoices 方法和 VoiceInfo 類別,取得您可以選取之已安裝文字轉換語音(TTS)語音的名稱和屬性。Use the GetInstalledVoices methods and VoiceInfo class to obtain the names and attributes of installed text-to-speech (TTS) voices that you can select.

若要停止使用指定的語音 StartVoice 呼叫 EndVoiceTo 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.

備註

StartVoiceculture 參數可以不同于包含它之 PromptBuilder 物件的 Culture 屬性。The 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. SpeechSynthesizer 將嘗試選取支援由 culture 參數所指定之語言的已安裝語音,以說出 StartVoiceEndVoice所括住的內容。The 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-CN。zh-CN. 中文 (中國)Chinese (China)

  • zh-幼圓。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.

備註

使用 GetInstalledVoices 方法和 VoiceInfo 類別,取得您可以選取之已安裝文字轉換語音(TTS)語音的名稱和屬性。Use the GetInstalledVoices methods and VoiceInfo class to obtain the names and attributes of installed text-to-speech (TTS) voices that you can select.

若要停止使用指定的語音 StartVoice 呼叫 EndVoiceTo stop using the voice specified by StartVoice call EndVoice.

適用於