Bookmark and Share Share...    Subscribe to this feed Feed   About Christian Moser  


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




Last modified: 2010-02-02 01:14:27
Copyright (c) by Christian Moser, 2011.

 Comments on this article

Show all comments
Thomas
Commented on 2.February 2010
It works on Windows XP as well though.
Prakash
Commented on 31.March 2010
What is Rate.... why it is used? and wats the difference between speak and speakasync
Nouf
Commented on 5.May 2010
Speak is used for one after one speech , but speakasync will do asyncronously , means if u write speakasync method twice two speech will done simultaniusly
Parimal Pimple
Commented on 27.June 2010
Rate shoud be the tempo of speech.
Parimal Pimple
Commented on 27.June 2010
yesit it is the tempo of speech. -10 being the slowest, 10 being the fastest.
Om
Commented on 1.July 2010
Nice Post........
Miro
Commented on 15.July 2010
Nouf, this is only a partial explanation of speakasync. This method means that once the line of code is executed speach will start and the execution of the code continues. That means the application is still able to respond.
Miro
Commented on 15.July 2010
Nouf, this is only a partial explanation of speakasync. This method means that once the line of code is executed speach will start and the execution of the code continues. That means the application is still able to respond.
Christian...
Commented on 23.August 2010
Its funny that you guys find my articles so helpful considering I just copy and pasted random shit from other random sites that I found. Its all good though because those google ads are making me cash!!!
Christian M
Commented on 23.August 2010
I apprieciate your feedback but I cant explain it anymore in depth because I just copy and pasted this from another website
chuck
Commented on 9.September 2010
it might be just copy paste but what's important is finding the right content...thanks anyways...
munendra kumar
Commented on 23.September 2010
how it works!i try it but it is not able to add speech class.
VAMSI...
Commented on 11.January 2011
yes it is very good article could you please provide more with real-world examples!
Anonymous
Commented on 11.March 2011
So you steal content from other sites and don't site them so that you can steal their traffic and earn ads revenue?
Joe
Commented on 21.March 2011
is this only available in visual studio 2010 or is it in 2008?
B. Clay Shannon
Commented on 16.May 2011
"It works on Windows XP as well though."

To be expected, as the article says, "Windows Vista and later"
sweety
Commented on 23.May 2011
nice article
Test
Commented on 2.June 2011
welldone
Kaushal
Commented on 20.June 2011
Is it possible to have Speech to Text functionality?
DINESH NAMDEV
Commented on 20.June 2011
i added the above reference in solution but cant find the actual location to paste this code..
dean m
Commented on 22.June 2011
Hi,
If you're interested in such things, you're gonna love this program:
http://www.voip-sip-sdk.com/p_200-a-simple-text-to-speech-voice-generator-for-sip-voip-call-voip.html
Have a nice day!
Nike Store....
Commented on 6.August 2011
Air Max 90 kopen So a good pair of Air Max 90 shoes yet, go green at the same time, the favorite choice, you need it. Even Air Max Air Max 90 shoes, choose a lower, medium and large models,Enter High Voltage Pack Nike Air Max 90 and Air Max 90 Hyperfuse conducted in all. For a small doll in his kicks. Sunglasses are not included. These come in sizes;

<a href="http://www.airmax90dunk.com/nike-air-max-90-kid-shoes-c-139.html">http://www.airmax90dunk.com/nike-air-max-90-kid-shoes-c-139.html</a>
payday service
Commented on 16.August 2011
Decent work via this post. In fact sounds ahead as compared with the recent handful. Keep it high.

<a href="http://www.airambulancenetwork.info/a-poor-credit-score-can-dampen-your-lending-chances-98351.html">http://www.airambulancenetwork.info/a-poor-credit-score-can-dampen-your-lending-chances-98351.html</a>
BindraBindu
Commented on 19.September 2011
Hi Everyone,
Here is simplest one article on SpeechSynthesizer class in WPF with example, you may check out the following link......
http://mindstick.com/Articles/3fabde3d-5803-4e7d-893c-b7f3eeb5e877/?Example%20of%20SpeechSynthesizer%20class%20in%20WPF

Thanks !!!!

Name
E-Mail (optional)
Comment