0

I am now doing work regarding speech recognition in C# using windows7. I don't know what I am doing wrong. This code doesn't gives any errors but at the same time it doesn't even recognize anything nor responds... Any help will be greatly appreciated.

SpeechRecognitionEngine RecognitionEngine = new SpeechRecognitionEngine();
RecognitionEngine.SetInputToDefaultAudioDevice();
RecognitionResult Result = RecognitionEngine.Recognize();
StringBuilder Output = new StringBuilder();
foreach (RecognizedWordUnit word in Result.Words)
{
    Output.Append(word.Text);
}
Otiel
  • 18,404
  • 16
  • 78
  • 126
Abid Ali
  • 1,731
  • 8
  • 26
  • 62

2 Answers2

0
  1. Ensure your input device works correct.
  2. Try to increase initial silence interval (e.g. RecognitionEngine.Recognize(TimeSpan.FromSeconds(2)) )

PS: I would use asynchronous recognition if I were you

Andrey Atapin
  • 7,745
  • 3
  • 28
  • 34
0

Did you specify a grammar? If you're on Windows 7, you should specify and load the Dictation grammar. Something like:

SpeechRecognitionEngine recognizer = new SpeechRecognitionEngine();
Grammar dictationGrammar = new DictationGrammar();
recognizer.LoadGrammar(dictationGrammar);
recognizer.SetInputToDefaultAudioDevice();
RecognitionResult result = recognizer.Recognize();

See SAPI and Windows 7 Problem for an example I've posted before.

Community
  • 1
  • 1
Michael Levy
  • 13,097
  • 15
  • 66
  • 100
  • i found this link.. is this helpfull ? http://blindcrawler.com/blog/blog1.php/2010/09/09/tutorial-using-32-bit-sapi-5-voices-in-64-bit-windows-7 – Abid Ali Dec 15 '11 at 10:14
  • 1
    why is that link related? Are you using 32 bit SAPI 5 on 64 bit Windows 7? This article is also about using text to speech (TTS) voices, not Speech Recognition. – Michael Levy Dec 15 '11 at 15:28
  • can you please find me any SPEECH TO TEXT API ? i am struggling in finding it .. can you provide me with any helpfull link – Abid Ali Dec 17 '11 at 17:59
  • I'm not sure I understand. You said you were using C# on Windows 7. You posted a sample with classes from System.Speech.Recognition. The documentation is all at http://msdn.microsoft.com/en-us/library/ms554855.aspx and good helpful information is at http://msdn.microsoft.com/en-us/library/hh361625.aspx – Michael Levy Jan 04 '12 at 15:15