PromptBuilder::AppendBreak Method ()

 

Appends a break to the PromptBuilder object.

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

public:
void AppendBreak()

This method does not specify a duration for the break. The SpeechSynthesizer will determine a duration value based on the linguistic context.

The following example builds a prompt containing two sentences separated by a break and speaks the prompt to the default audio device on the computer.

using System;
using System.Speech.Synthesis;

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

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

        // Configure the audio output. 
        synth.SetOutputToDefaultAudioDevice();

        // Build a prompt with two sentences separated by a break.
        PromptBuilder builder = new PromptBuilder(
          new System.Globalization.CultureInfo("en-US"));
        builder.AppendText(
          "Tonight's movie showings in theater A are at 5:45, 7:15, and 8:45.");
        builder.AppendBreak();
        builder.AppendText(
          "Tonight's movie showings in theater B are at 5:15, 7:30, and 9:15.");

        // Speak the prompt.
        synth.Speak(builder);
      }

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

.NET Framework
Available since 3.0
Return to top
Show: