SpeechSynthesizer.SetOutputToDefaultAudioDevice メソッド

定義

SpeechSynthesizer オブジェクトを、既定のオーディオ デバイスへの出力を送信するように構成します。

public:
 void SetOutputToDefaultAudioDevice();
public void SetOutputToDefaultAudioDevice ();
member this.SetOutputToDefaultAudioDevice : unit -> unit
Public Sub SetOutputToDefaultAudioDevice ()

次の例では、シンセサイザーを使用して、既定のオーディオ出力に対して語句を読み上げます。

using System;  
using System.Speech.Synthesis;  

namespace SampleSynthesis  
{  
  class Program  
  {  
    static void Main(string[] args)  
    {  

      // Initialize a new instance of the speech synthesizer.  
      using (SpeechSynthesizer synth = new SpeechSynthesizer())  
      {  

        // Configure the synthesizer to send output to the default audio device.  
        synth.SetOutputToDefaultAudioDevice();  

        // Speak a phrase.  
        synth.Speak("This is sample text-to-speech output.");  
      }  

      Console.WriteLine();  
      Console.WriteLine("Press any key to exit...");  
      Console.ReadKey();  
    }  
  }  
}  

注釈

コンピューターの既定のオーディオデバイスを構成するには、Windows の コントロールパネル の [サウンド] ウィンドウを使用します。

その他の出力構成オプションについては、「」、「」、「」、および「」を参照してください SetOutputToAudioStream SetOutputToNull SetOutputToWaveFile SetOutputToWaveStream

適用対象