Click here to Skip to main content
15,880,796 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to stop the current running thread by saying "stop" in c# speechsynthesizer and speechrecognition engine, the problem is the speak would block the system and keep on speaking the text of my inbox email , since emails are too large I want to say stop between speaking and move on to next task but it wont do any other task before it finishes , how can i do this?

What I have tried:

speakasync() wont work I have tried it
Posted
Updated 20-Oct-16 13:15pm
v2
Comments
gggustafson 20-Oct-16 18:28pm    
Are you using separate threads: one to read you emails; another to recognize "stop"?

1 solution

I recommend creating another recognizer object that is always active and it will only recognize your stop or continue speaking words.

The stopRecognizer should then stop the main one.

Here's a code sample:
C#
private SpeechRecognitionEngine stopListener = new SpeechRecognitionEngine(new CultureInfo("en-US"));

private SpeechRecognitionEngine recEngine = new SpeechRecognitionEngine(new CultureInfo("en-US"));

private SpeechSynthesizer speaker = new SpeechSynthesizer();


In the Recognized event of stopListener you should make the SpeechSynthesizer stop speaking.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900