SpeechSynthesizer.AllVoices プロパティ

定義

インストールされているすべての音声合成エンジン (音声) のコレクションを取得します。

public:
 static property IVectorView<VoiceInformation ^> ^ AllVoices { IVectorView<VoiceInformation ^> ^ get(); };
static IVectorView<VoiceInformation> AllVoices();
public static IReadOnlyList<VoiceInformation> AllVoices { get; }
var iVectorView = SpeechSynthesizer.allVoices;
Public Shared ReadOnly Property AllVoices As IReadOnlyList(Of VoiceInformation)

プロパティ値

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 を呼び出します)。

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

適用対象

こちらもご覧ください