PromptBuilder::AppendText Method (String^, PromptRate)
.NET Framework (current version)
Appends text to the PromptBuilder object and specifies the speaking rate for the text.
Assembly: System.Speech (in System.Speech.dll)
Parameters
- textToSpeak
-
Type:
System::String^
A string containing the text to be spoken.
- rate
-
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. synth.SetOutputToDefaultAudioDevice(); // 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. synth.Speak(speakRate); } Console.WriteLine(); Console.WriteLine("Press any key to exit..."); Console.ReadKey(); } } }
.NET Framework
Available since 3.0
Available since 3.0
Show: