SpeechSynthesizer.SelectVoiceByHints 方法

定義

選取特定特性的語音。

多載

SelectVoiceByHints(VoiceGender)

選取特定性別的語音。

SelectVoiceByHints(VoiceGender, VoiceAge)

選取特定性別和年齡的語音。

SelectVoiceByHints(VoiceGender, VoiceAge, Int32)

根據已排序的語音位置,選取特定性別和年齡的語音。

SelectVoiceByHints(VoiceGender, VoiceAge, Int32, CultureInfo)

根據已排序的語音位置,選取特定性別、年齡和地區設定的語音。

備註

GetInstalledVoices您可以使用方法和 VoiceInfo 類別,取得所安裝之文字轉換語音 (TTS) 語音的名稱。 SpeechSynthesizer物件會選取第一個符合指定特性的已安裝語音。

當應用程式呼叫時 GetInstalledVoices ,此方法會確認它在登錄中找到的每個聲音是否符合特定的最小準則。 針對驗證失敗的任何聲音, GetInstalledVoices 將其 Enabled 屬性設定為 False 。 應用程式無法選取其 Enabled 屬性為的聲音 False 。 一般來說,應用程式不會設定語音的 Enabled 屬性。

若要依名稱選取語音,請使用 SelectVoice 方法

SelectVoiceByHints(VoiceGender)

選取特定性別的語音。

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)

參數

gender
VoiceGender

要選取的語音的性別。

備註

GetInstalledVoices您可以使用方法和 VoiceInfo 類別,取得所安裝之文字轉換語音 (TTS) 語音的名稱。 SpeechSynthesizer物件會選取第一個已安裝的語音,其 Gender 屬性符合 gender 參數。

當應用程式呼叫時 GetInstalledVoices ,此方法會確認它在登錄中找到的每個聲音是否符合特定的最小準則。 針對驗證失敗的任何聲音, GetInstalledVoices 將其 Enabled 屬性設定為 False 。 應用程式無法選取其 Enabled 屬性為的聲音 False 。 一般來說,應用程式不會設定語音的 Enabled 屬性。

若要根據其他特性來選取語音,請參閱其他 SelectVoiceByHints 方法。

若要依名稱選取語音,請使用 SelectVoice 方法。

另請參閱

適用於

SelectVoiceByHints(VoiceGender, VoiceAge)

選取特定性別和年齡的語音。

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)

參數

gender
VoiceGender

要選取的語音的性別。

age
VoiceAge

要選取之語音的年齡。

備註

GetInstalledVoices您可以使用方法和 VoiceInfo 類別,取得所安裝之文字轉換語音 (TTS) 語音的名稱。 SpeechSynthesizer物件會選取第一個安裝的語音 Gender ,其和 Age 屬性會符合 genderage 參數。

當應用程式呼叫時 GetInstalledVoices ,此方法會確認它在登錄中找到的每個聲音是否符合特定的最小準則。 針對驗證失敗的任何聲音, GetInstalledVoices 將其 Enabled 屬性設定為 False 。 應用程式無法選取其 Enabled 屬性為的聲音 False 。 一般來說,應用程式不會設定語音的 Enabled 屬性。

若要根據其他特性來選取語音,請參閱其他 SelectVoiceByHints 方法。

若要依名稱選取語音,請使用 SelectVoice 方法。

另請參閱

適用於

SelectVoiceByHints(VoiceGender, VoiceAge, Int32)

根據已排序的語音位置,選取特定性別和年齡的語音。

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)

參數

gender
VoiceGender

要選取的語音的性別。

age
VoiceAge

要選取之語音的年齡。

voiceAlternate
Int32

要選取之語音的位置。

備註

GetInstalledVoices您可以使用方法和 VoiceInfo 類別,取得所安裝之文字轉換語音 (TTS) 語音的名稱。 SpeechSynthesizer物件會尋找其 GenderAge 屬性符合 genderage 參數的已安裝語音。 SpeechSynthesizer會計算找到的相符專案,並在計數等於參數時傳回語音 voiceAlternate

當應用程式呼叫時 GetInstalledVoices ,此方法會確認它在登錄中找到的每個聲音是否符合特定的最小準則。 針對驗證失敗的任何聲音, GetInstalledVoices 將其 Enabled 屬性設定為 False 。 應用程式無法選取其 Enabled 屬性為的聲音 False 。 一般來說,應用程式不會設定語音的 Enabled 屬性。

若要根據其他特性來選取語音,請參閱其他多載 SelectVoiceByHints

若要依名稱選取語音,請使用 SelectVoice 方法。

另請參閱

適用於

SelectVoiceByHints(VoiceGender, VoiceAge, Int32, CultureInfo)

根據已排序的語音位置,選取特定性別、年齡和地區設定的語音。

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)

參數

gender
VoiceGender

要選取的語音的性別。

age
VoiceAge

要選取之語音的年齡。

voiceAlternate
Int32

要選取之語音的位置。

culture
CultureInfo

要選取之語音的地區設定。

備註

SpeechSynthesizer物件會尋找其 GenderAgeCulture 屬性符合 gender 、和參數 age culture 的語音。 SpeechSynthesizer會計算找到的相符專案,並在計數等於參數時傳回語音 voiceAlternate

Microsoft Windows 和 Speech API 接受所有有效的語言國家/地區代碼。 若要使用參數中指定的語言執行文字轉換語音 culture ,必須安裝支援該語言國家/地區代碼的語音合成引擎。 隨附于 Microsoft Windows 7 的語音合成引擎可使用下列語言國家/地區代碼:

  • en-us。 英文 (美國)

  • zh-CN。 簡體中文

  • zh-幼圓。 中文 (台灣)

也允許兩個字母的語言代碼(例如 "en")。

當應用程式呼叫時 GetInstalledVoices ,此方法會確認它在登錄中找到的每個聲音是否符合特定的最小準則。 針對驗證失敗的任何聲音, GetInstalledVoices 將其 Enabled 屬性設定為 False 。 應用程式無法選取其 Enabled 屬性為的聲音 False 。 一般來說,應用程式不會設定語音的 Enabled 屬性。

若要根據其他特性來選取語音,請參閱其他多載 SelectVoiceByHints

若要依名稱選取語音,請使用 SelectVoice 方法。

另請參閱

適用於