How to use the Speech Synthesizer in WPF
Microsoft provides a new speech API (SAPI) for Windows Vista and
later. It allows developers to build speech enabled applications. Simply
add a reference to
System.Speech
and include the following code to your project.
using System.Speech.Synthesis;
SpeechSynthesizer synthesizer = new SpeechSynthesizer();
synthesizer.Volume = 50; // 0...100
synthesizer.Rate = 3; // -10...10
// Synchronous
synthesizer.Speak("Welcome to the WPF Tutorial.");
// Asynchronous
synthesizer.SpeakAsync("Welcome to the WPF Tutorial.");
No comments:
Post a Comment