I was playing around with this SAPI v5.1 library. So I was testing a sample WAV file I have. (Download it from here). Anyway, the sound in that file is clear and easy. It contains only one word which is number three. Now when I run the following code, I get number 8 or "eight". If I remove it, I get 7. If I try to randomize the list I get different results and so on. I'm really getting confused and started to think that SpeachRecognition in SAPI library doesn't work at all...
Anyway here is what I'm doing,
private void button1_Click(object sender, EventArgs e)
{
//Add choices to grammar.
Choices mychoices = new Choices();
mychoices.Add("one");
mychoices.Add("two");
mychoices.Add("three");
mychoices.Add("four");
mychoices.Add("five");
mychoices.Add("six");
mychoices.Add("seven");
mychoices.Add("eight");
mychoices.Add("nine");
mychoices.Add("zero");
mychoices.Add("1");
mychoices.Add("2");
mychoices.Add("3");
mychoices.Add("4");
mychoices.Add("5");
mychoices.Add("6");
mychoices.Add("7");
mychoices.Add("8");
mychoices.Add("9");
mychoices.Add("0");
Grammar myGrammar = new Grammar(new GrammarBuilder(mychoices));
//Create the engine.
SpeechRecognitionEngine reco = new SpeechRecognitionEngine();
//Read audio stream from wav file.
reco.SetInputToWaveFile("3.wav");
reco.LoadGrammar(myGrammar);
//Get the recognized value.
reco.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(reco_SpeechRecognized);
reco.RecognizeAsync(RecognizeMode.Multiple);
}
void reco_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
MessageBox.Show(e.Result.Text);
}