Note

Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.

SpeechSynthesizer.SetOutputToDefaultAudioDevice Method

Configures the SpeechSynthesizer object to send output to the default audio device for the system.

Namespace:  Microsoft.Speech.Synthesis
Assembly:  Microsoft.Speech (in Microsoft.Speech.dll)

Syntax

'Declaration
Public Sub SetOutputToDefaultAudioDevice
'Usage
Dim instance As SpeechSynthesizer

instance.SetOutputToDefaultAudioDevice()
public void SetOutputToDefaultAudioDevice()

Remarks

For other output configuration options, see the SetOutputToAudioStream, SetOutputToNull, SetOutputToWaveFile, and SetOutputToWaveStream methods.

Examples

The following example uses the synthesizer to speak a phrase to the default audio output.

using System;
using Microsoft.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();
    }
  }
}

See Also

Reference

SpeechSynthesizer Class

SpeechSynthesizer Members

Microsoft.Speech.Synthesis Namespace