SpeechSynthesizer.Voice SpeechSynthesizer.Voice SpeechSynthesizer.Voice SpeechSynthesizer.Voice Property

定義

SpeechSynthesizer オブジェクトの現在の音声に関する情報を取得します。Gets information about the current voice of the SpeechSynthesizer object.

public:
 property System::Speech::Synthesis::VoiceInfo ^ Voice { System::Speech::Synthesis::VoiceInfo ^ get(); };
public System.Speech.Synthesis.VoiceInfo Voice { get; }
member this.Voice : System.Speech.Synthesis.VoiceInfo
Public ReadOnly Property Voice As VoiceInfo

プロパティ値

SpeechSynthesizer オブジェクトの現在の音声に関する情報を返します。Returns information about the current voice of the SpeechSynthesizer object.

次の例では、のSpeechSynthesizerインスタンスを初期化し、現在の音声に関する情報を取得します。The following example initializes an instance of SpeechSynthesizer and gets information about the current voice.

using System;  
using System.IO;  
using System.Speech.Synthesis;  
using System.Speech.AudioFormat;  
  
namespace SampleSynthesis  
{  
  class Program  
  {  
    static void Main(string[] args)  
    {  
  
      // Initialize a new instance of the SpeechSynthesizer.  
      using (SpeechSynthesizer synth = new SpeechSynthesizer())  
      {  
  
        // Get information about supported audio formats.  
        string AudioFormats = "";  
        foreach (SpeechAudioFormatInfo fmt in synth.Voice.SupportedAudioFormats)  
        {  
          AudioFormats += String.Format("{0}\n",  
          fmt.EncodingFormat.ToString());  
        }  
  
        // Write information about the voice to the console.  
        Console.WriteLine(" Name:          " + synth.Voice.Name);  
        Console.WriteLine(" Culture:       " + synth.Voice.Culture);  
        Console.WriteLine(" Age:           " + synth.Voice.Age);  
        Console.WriteLine(" Gender:        " + synth.Voice.Gender);  
        Console.WriteLine(" Description:   " + synth.Voice.Description);  
        Console.WriteLine(" ID:            " + synth.Voice.Id);  
        if (synth.Voice.SupportedAudioFormats.Count != 0)  
        {  
          Console.WriteLine(" Audio formats: " + AudioFormats);  
        }  
        else  
        {  
          Console.WriteLine(" No supported audio formats found");  
        }  
  
        // Get additional information about the voice.  
        string AdditionalInfo = "";  
        foreach (string key in synth.Voice.AdditionalInfo.Keys)  
        {  
          AdditionalInfo += String.Format("  {0}: {1}\n",  
            key, synth.Voice.AdditionalInfo[key]);  
        }  
  
        Console.WriteLine(" Additional Info - " + AdditionalInfo);  
        Console.WriteLine();  
      }  
  
      Console.WriteLine();  
      Console.WriteLine("Press any key to exit...");  
      Console.ReadKey();  
    }  
  }  
}  
  

注釈

新しいSpeechSynthesizerを初期化すると、既定のシステム音声が使用されます。When you initialize a new SpeechSynthesizer, it uses the default system voice. インストールされSpeechSynthesizerている音声合成の音声の1つを使用するようSelectVoiceSelectVoiceByHintsオブジェクトを構成するには、メソッドまたはメソッドを使用します。To configure the SpeechSynthesizer object to use one of the installed speech synthesis voices, use the SelectVoice or SelectVoiceByHints method. インストールされている音声に関する情報を取得GetInstalledVoicesするにはVoiceInfo 、メソッドとクラスを使用します。To get information about which voices are installed, use the GetInstalledVoices method and the VoiceInfo class.

適用対象

こちらもご覧ください