PromptBuilder.AppendText Method (String, PromptRate)


Appends text to the PromptBuilder object and specifies the speaking rate for the text.

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

public void AppendText(
	string textToSpeak,
	PromptRate rate


Type: System.String

A string containing the text to be spoken.

Type: System.Speech.Synthesis.PromptRate

The value for the speaking rate to apply to the text.

The following example creates a PromptBuilder object and appends text strings. The example uses the AppendText method to specify a slow speaking rate for the string being added, which enumerates the contents of an order.

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. 

        // Create a PromptBuilder object and add content.
        PromptBuilder speakRate = new PromptBuilder();
        speakRate.AppendText("Your order for");
        speakRate.AppendText("one kitchen sink and one faucet", PromptRate.Slow);
        speakRate.AppendText("has been confirmed.");

        // Speak the contents of the SSML prompt.

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

.NET Framework
Available since 3.0
Return to top