Click here to Skip to main content
15,890,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have following code for creating an grammer file ... but have some problem

code as follows
C#
private SpeechRecognitionEngine rec = new SpeechRecognitionEngine();
rec.SetInputToDefaultAudioDevice();
string [] s={"My Computer","My Document","C Drive"};
grammerbuilder gb=new grammerBuilder();
gb.Append(s);
 rec.LoadGrammar(gb);
 rec.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(rec_SpeechRecognized);
rec.RecognizeAsync(RecognizeMode.Multiple);
                //RecognizedPhrase wordes = new RecognizedPhrase();
         
// this is an event method
void rec_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
                    foreach (RecognizedWordUnit word in e.Result.Words)
            {

                   strdata = strdata +"  "+ word.Text;
            }
            textBox1.Text = strdata;

please see the above code by running it and solve my problem...
give me reply as soon as possible...
i am waiting for you...
Posted
v2

1 solution

here is a good article for you
Create a Speech Recognition Grammar[^]
here are some best articles for Speech Recognition
C# Speech to Text[^]
Speech recognition in C#[^]
 
Share this answer
 

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