共用方式為


VoiceInformation.Gender 屬性

定義

取得語音合成引擎 (語音) 的性別設定。

public:
 property VoiceGender Gender { VoiceGender get(); };
VoiceGender Gender();
public VoiceGender Gender { get; }
var voiceGender = voiceInformation.gender;
Public ReadOnly Property Gender As VoiceGender

屬性值

語音的性別。

範例

在這裡,我們會示範如何使用找到第一個女性語音 ( (VoiceGender) ,或只選取語音 (SpeechSynthesizer.DefaultVoice) 的預設系統語音) 的) 性別。

using (SpeechSynthesizer synthesizer = new SpeechSynthesizer())
{
    VoiceInformation voiceInfo =
        (
            from voice in SpeechSynthesizer.AllVoices
            where voice.Gender == VoiceGender.Female
            select voice
        ).FirstOrDefault() ?? SpeechSynthesizer.DefaultVoice;

    synthesizer.Voice = voiceInfo;

    // Windows.Media.SpeechSynthesis.SpeechSynthesisStream
    stream = await synthesizer.SynthesizeTextToStreamAsync(text);
}

備註

以下是隨附于 Windows 的 Microsoft 簽署語音清單。

語音性別Windows 8Windows 8.1名稱顯示名稱
英文 (美國)FemaleYYZiraMicrosoft Zira (en-US,女性) 。
英文 (美國)MaleYYDavidMicrosoft David (en-US, male)
英文 GBFemaleYY榛子Microsoft Hazel (en-GB,女性)
法文 FRFemaleYYHortenseMicrosoft Hortense (fr-FR 、女性)
德文 DEFemaleYYHeddaMicrosoft Hedda (de-DE,女性)
西班牙文 ESFemaleYY海倫娜Microsoft Femalea (es-ES,女性)
中國FemaleYYHuihuiMicrosoft Huihui (zh-CN,女性)
中文 TWFemaleYY韓寒Microsoft Hanhan (zh-TW,女性)
日文 JAFemaleYYHarukaMicrosoft Haruka (ja-JP,女性)
韓文 KRFemaleYYHeamiMicrosoft Heami (ko-KR,女性)
西班牙文 MXFemaleNYMicrosoft Sabina (es-MX,女性)
義大利文 ITFemaleNY艾 爾 莎Microsoft Elsa (it-IT,女性)
英文 INFemaleNYHeeraMicrosoft Heera (en-IN,女性)
俄文 RUFemaleNY伊麗娜Microsoft I (ru-RU,女性)
中文 (香港特別行政區)FemaleNY特 蕾 西Microsoft Tracy (zh-HK,女性)
波蘭文 PLFemaleNYPaulinaMicrosoft Paulina (pl-PL,女性)
葡萄牙文 BRFemaleNYMariaMicrosoft Maria (pt-BR,女性)

適用於

另請參閱