Sharing the things I learn day by day

Friday, June 24, 2011

SPEECH RECOGNITION USING C#


Hey All,

In this blog post I will show how to make a simple speech recognition system using c#. I’m using Visual Studio 2008 for this demonstration.

First up create a new windows forms project in visual studio.












What I will be going to do is that, I will match the words that the user speaks with the words in the dictionary and if a match is found it will be printed in the list box.

So add a list box to the form and change the name of the list box to “recWords”.




















Double click on the form to get the Form Load event. To recognize speech you have to add the System.Speech Reference.






















Once you add the reference, add the namespace to the project as well.








This provides the Speech Recognition Engine. You have to create an object from the SpeechRecognitionEngine Class.















Next up you have to write the speech recognition code. In this case I will be writing it in the form load event.










So now you have to implement the engine_SpeechRecognized event. So what I’m going to do in this is that I will get the recognized word from the engine and print it out to the list box.










That’s it. Run the application and speak into the microphone and you will see the recognized words printing on the list box. The words spoken have to be very clear. Otherwise the engine will recognize another word with similar pronunciation. 

That’s all for this post.
Happy Coding.