Dela via


VoiceInformation.Gender Property

Definition

Gets the gender setting of the speech synthesis engine (voice).

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

Property Value

The gender of the voice.

Examples

Here, we show how to select a gender for the voice (VoiceInformation.Gender) by using either the first female voice (VoiceGender) found, or just the default system voice (SpeechSynthesizer.DefaultVoice), if no female voice is found.

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);
}

Remarks

Here is a list of Microsoft-signed voices provided with Windows.

VoiceGenderWindows 8Windows 8.1NameDisplay name
English USFemaleYYZiraMicrosoft Zira (en-US, female).
English USMaleYYDavidMicrosoft David (en-US, male)
English GBFemaleYYHazelMicrosoft Hazel (en-GB, female)
French FRFemaleYYHortenseMicrosoft Hortense (fr-FR , female)
German DEFemaleYYHeddaMicrosoft Hedda (de-DE, female)
Spanish ESFemaleYYHelenaMicrosoft Helena (es-ES, female)
Chinese PRCFemaleYYHuihuiMicrosoft Huihui (zh-CN, female)
Chinese TWFemaleYYHanhanMicrosoft Hanhan (zh-TW, female)
Japanese JAFemaleYYHarukaMicrosoft Haruka (ja-JP, female)
Korean KRFemaleYYHeamiMicrosoft Heami (ko-KR, female)
Spanish MXFemaleNYSabinaMicrosoft Sabina (es-MX, female)
Italian ITFemaleNYElsaMicrosoft Elsa (it-IT, female)
English INFemaleNYHeeraMicrosoft Heera (en-IN, female)
Russian RUFemaleNYIrinaMicrosoft Irina (ru-RU, female)
Chinese HKFemaleNYTracyMicrosoft Tracy (zh-HK, female)
Polish PLFemaleNYPaulinaMicrosoft Paulina (pl-PL, female)
Portuguese BRFemaleNYMariaMicrosoft Maria (pt-BR, female)

Applies to

See also