C# Programming | Speech Recognition & Text to Speech!!! [Full Tutorial]

Share it with your friends Like

Thanks! Share it with your friends!


Program your computer to LISTEN to YOU + RESPOND! [C# Programming] It is extremely easy to do, and in a few minutes, you’ll be asking your computer to do tasks for you!

My Equipment:
Behringer UMC22: https://amzn.to/30hrpWj
Audio-Technica AT2020: https://amzn.to/31EYZSt

Link to have all English words in grammar without typing them: http://youtu.be/gEBWsLSRVL4
Program Code: http://goo.gl/zhMFV [Google Drive .txt file]
[If you just copy the code, remember to add the reference for speech recognition by going to the ‘references’ drop down area in the Solution Explorer, right-click on it, and click ‘Add Reference’. Click ‘.NET’ at the top, or ‘Framework’ on v.2012 and scroll down until you see ‘System.Speech’. Check the check box, and your copied code will now work!]


coders says:

sir this was informative. Please tell me how to form speech recognition in C++

Zine El Abidine says:

thanks for this tuto

TattooMafew says:

It's been six years since you made this video so you probably figured out the problem but, if you haven't.. Your speech recognition engine is still listening while your speech synthesis is speaking and you programmed your speech synthesis to repeat what was recognized by your speech recognition engine which retriggers over and over in an endless loop.

Bilal Manzoor says:

Thank you for uploading this Tutorial

Rick Buring says:

@ Nerd'S Best Advice

the repeating commands are there because e.result.alternate has a property count and every time you turn it on and off this counter goes up, I don't know why you would want that but a solution I found is in this code line to add sRecognize.MaxAlternate = 1; like this



sRecognize.RequestRecognizerUpdate ();

sRecognize.loadGrammar (gr);

sRecognize.MaxAlternate = 1;

sRecognize.speechRecognized + = sRecognize_SpeechRecognized;

sRecognize.recognizeAsync (RecognizeMode.Multiple);


sorry for any spelling errors

Randy Wilson says:


A. N. says:

guys i want my cursor to jump to next textbox when i say next can that happen??? and how ??? can someone plzz tell me about it😢😢

Lu Xelubonbon says:

tks you for this video.=)

Ruel SISCO says:

hi can you help me please its my project in our school please…

ahmed elakrab says:

Hey, I just want to thank you for sharing this great TUT,but I have a problem :the program is debugging without any error but it does actually nothing; it does not speak the text i write, it does nothing I don't know what's wrong.
PS: I created a new project named it Speaker, then I created the text box plus the 3 buttons kept their names and added the reference then I just copied the whole code from your .txt and paste it in the form.cs..but unfortunately it didn't work for me. what could do to fix it ? thanks in advance

2willcat says:

How would I change the voice?

Ludwig Krauser says:

Urm Mr, how can I make it stop listening while it is speaking?
i tried using 
if (sSynth.state == SynthesizerState.Speaking)
{ listening = false; }
Please reply, I've tried many ways, and also google doesnt give me answers as well.

Mister Melone says:

Does it work With console applications?

Sadiq M says:

SetInputToDefaultAudioDevice not showing intelligence and recognizeAsyc also not showing please help me

Keith Lashley says:

My program isn't showing any errors however the program isn't recognizing my voice.

Allan Ojeda says:

well I did this to solve that problem

public partial class Form1 : Form
        int a = 0;

if (a==0){

WellNowLetsSee says:

Dude, nice! I've never played with the speech stuff but this gives me fun ideas!

I didn't see any comments about fixing the double text, but I'd say it's because the "SpeechRecognized" event handler is being re/created on the button click. If you start 5 times you'll get 5 duplicates. I would define the global variables either in public Form1() or in the Form1_Load(). Hopes this helps anyone going through the comments.

Mansour Yaacoubi says:

although I facepalmed sometimes… I thank you very much for this easy how-to. Keep doing this!

Bobby Frazier says:

you can fix the error at the end by re initializing the SpeechRecognitionEngine in button2_Click

Ricardo A-G says:

Thank you! This is so amazing 🙂
Now I'm using speech recognition, too. Very useful but sometimes, it doesn't work, idk :/

Sam Bolton says:

does this work on mac?

Dalvir Singh says:

 sre.SpeechRecognized += sre.SpeechRecognized;
i have error on this line ?
help me

Amrendra Kumar says:

Thank you sir,its really very helpful.But sir i want to know something about how we give user speech input at the place of slist.

Write a comment


Area 51