Making Your WPF Applications Speak
It's amazingly easy to add speech synthesis to WPF applications.
WPF's speech synthesis capabilities are often lost in the rich feature set of the platform.
Last year, I wrote a blog post about Speech Synthesis in WPF.
I thought it would be cool to write an Extension Method that encapsulates speech synthesis functionality, so that speaking would be as simple as
1: string sayThis;
2: sayThis.Speak();
The code to make this possible is this simple.
1: public static void Speak (this string text)
2: {3: SpeechSynthesizer synthesizer = new SpeechSynthesizer();
4: 5: synthesizer.SpeakAsync(text); 6: }
Be sure to add a reference to System.Speech and add the appropriate using statement.
1: using System.Speech.Synthesis;
Now if only Speech Synthesis existed in Silverlight. ;)