VoiceGender Enumerazione

Definizione

Specifica le preferenze di genere disponibili per la sintesi vocale (se supportate dal motore di sintesi vocale specificato).

public enum class VoiceGender
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
enum class VoiceGender
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public enum VoiceGender
var value = Windows.Media.SpeechSynthesis.VoiceGender.male
Public Enum VoiceGender
Ereditarietà
VoiceGender
Attributi

Requisiti Windows

Famiglia di dispositivi
Windows 10 (è stato introdotto in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (è stato introdotto in v1.0)

Campi

Female 1

Female

Male 0

Male

Esempio

Qui mostriamo come selezionare un sesso per la voce (VoiceInformation.Gender) usando la prima voce femminile (VoiceGender) trovata o solo la voce di sistema predefinita (SpeechSynthesizer.DefaultVoice), se non viene trovata alcuna voce femminile.

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

Si applica a

Vedi anche