VoiceGender 列挙型

定義

音声合成で使用できる性別設定を指定します (指定した音声合成エンジンでサポートされている場合)。

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
継承
VoiceGender
属性

Windows の要件

デバイス ファミリ
Windows 10 (10.0.10240.0 で導入)
API contract
Windows.Foundation.UniversalApiContract (v1.0 で導入)

フィールド

Female 1

Female

Male 0

Male

ここでは、見つかった最初の女性音声 (VoiceGender) または既定のシステム音声 (SpeechSynthesizer.DefaultVoice) を使用して、音声 (VoiceInformation.Gender) の性別を選択する方法を示します(女性の音声が見つからない場合)。

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

適用対象

こちらもご覧ください