Frank La Vigne

Fear and Loathing in .NET

MVP Logo
Tablet PC MVP

Social Networks

Subscription Options

Add to Google

Subscribe in Bloglines

My Links


Post Categories

Archives

Image Galleries

Cached @ 9/3/2010 2:50:46 AMControl ASP.skins_marvin3_controls_archivelinks_ascx

GamerTag

Dev Community Events

Blog Stats

Cached @ 9/3/2010 2:50:46 AMControl ASP.skins_marvin3_controls_blogstats_ascx  

News


Blog Roll

Favorite Sites

Gadget Blogs

Tablet PC Links

Cached @ 9/3/2010 2:50:46 AMControl ASP.skins_marvin3_controls_categorydisplay_ascx

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. ;)

 

posted on Thursday, May 08, 2008 12:16 PM

============ Debug Build ============
Dottext Version: 0.95.2004.102
Machine Name: IIS07902
.NET Version: 2.0.50727.3053
No User
============ Debug Build ============