Help with Windows speech recognizer, stops listening after some time...

  • Thread starter Thread starter NotPandaMack
  • Start date Start date
N

NotPandaMack

Guest
Here is the function that sets up the audio and grammar input etc for the speech recognizer.

private void Form1_Load(object sender, EventArgs e)
{

theTime.Start();
SpeechRecognitionEngine speechRec = new SpeechRecognitionEngine();

list.Add(File.ReadAllLines(@"H:\Alyssa Reborn\Alyssa Reborn\grammar\commands.txt"));
Grammar gr = new Grammar(new GrammarBuilder(list));


speechRec.LoadGrammar(gr);
speechRec.SpeechRecognized += speechRec_SpeechRecognized;
speechRec.SetInputToDefaultAudioDevice();
speechRec.RecognizeAsync(RecognizeMode.Multiple);
s.SelectVoiceByHints(VoiceGender.Female);

s.SelectVoice("CereVoice Jess - English (England)");


say(GreetingsFunction());
using (SpeechSynthesizer synth = new SpeechSynthesizer())
{

// Output information about all of the installed voices.
Console.WriteLine("Installed voices -");
foreach (InstalledVoice voice in synth.GetInstalledVoices())
{
VoiceInfo info = voice.VoiceInfo;
Console.WriteLine(" Voice Name: " + info.Name);
}
}
versionLabel.Text = "Version: " + versionReference.Version();
}

After X amount of time, it decides to just stop listening. The application is not frozen because all my animations and buttons work. The only work around to fixing this issue i have found right now is to have a button that re-runs the line of code above.

Things i've tried to fix this issue:

1) After numerous failed attempts, i decided to see if updating the speech recognizer every second would fix this issue, this made the program SUPER laggy and would glitch out and take one command as two and go completely berserk. I expected this, but it was wort a try.

2) Since there is no specific amount of time it takes for it to stop (usually between 5-15mins sometimes even longer) I just put a random timer for 130 seconds for it to refresh the speech recognizer, but since there is no known time of it bugging out, sometimes it would reload the speech, and again, take 1 command as two since it's loaded twice...

I'm completely out of ideas and would appreciate any help i could get :)

Continue reading...
 
Back
Top