Introduction
The Windows OS has incredible speech integration. You have either used a Windows application or your Android smart phone.
In our native Windows 7 Operating System, we have the Speech Application Program Interface (SAPI).
One of the applications of this is Windows speech recognition.
Background
We will use our one base class from the .NET Framework to show a simple demonstration of SAPI.
User Interface Design
For now, we will design a small UI that consists of a Label, Text Box and a Button.
It's as simple as a basic form with a few controls. Try to have a look-alike design. Or, you may have your own application. For the time being, I will use this design.
C# Back End Code
Foe the SAPI, we need a reference for the "Microsoft Speech Object Library".
So, do it yourself.
(* Click on "Add Reference" then select the "COM" Tab then select "Microsoft Speech Object Library".)
Then add the following:
Using SpeechLib; // in top of the .cs Code of your Form.
Now, we will program the Click Event for the button.
// Create an Object of SpVoice class.
SpVoice voice =new SpVoice(); //voice is Object name.
voice.Speech(textBox1.text, SpeechVoiceSpeakFlag.SVSFDefault);
// call the Speak() Method and two argument.
In the first argument, a string Type value, that you want to be spoken by the computer. It may be any variable or any TextBox content.