SpeechSynthesizer.DefaultVoice プロパティ

定義

既定の音声合成エンジン (音声) を取得します。

public:
 static property VoiceInformation ^ DefaultVoice { VoiceInformation ^ get(); };
static VoiceInformation DefaultVoice();
public static VoiceInformation DefaultVoice { get; }
var voiceInformation = SpeechSynthesizer.defaultVoice;
Public Shared ReadOnly Property DefaultVoice As VoiceInformation

プロパティ値

既定の音声。

ここでは、見つかった最初の女性音声 (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);
}

注釈

システムにインストールされている Microsoft 署名付き音声のみを使用して、 SpeechSynthesizer で音声を生成できます。 各音声は、特定の国/地域で話されているように、1 つの言語で合成された音声を生成します。

既定では、新しい SpeechSynthesizer オブジェクトは現在のシステム音声を使用します (DefaultVoice を呼び出して、既定の音声が何であるかを確認します)。

ユーザーのシステムにインストールされている他の音声合成 (テキスト読み上げ) 音声のいずれかを指定するには、 Voice メソッドを使用します (システムにインストールされている 音声 を確認するには、 AllVoices を呼び出します)。

言語を指定しない場合は、[言語] コントロール パネルで選択した言語に最も近い音声が読み込まれます。

適用対象

こちらもご覧ください