0

I am considering upgrading my program, which uses System.Speech.Recognition in the background for continuous speech recognition. I can do continuous speech recognition using Windows.Media.SpeechRecognition, which is much better quality, but losing focus of the console app, or even just running it without any foreground app and just having it run in the background causes it to not recognize anymore. It seems that the app being in focus is a requirement to run speech recognition.

Is there a way around this? Maybe a way to trick the program/Windows into thinking its in focus?

I've looked at the following:

https://social.msdn.microsoft.com/Forums/vstudio/en-US/3f0c9a2e-6d33-499b-80be-8d24f7e33c2b/c-continuous-speech-recognition-in-background?forum=wpdevelop

Why does UWP continuous speech recognition stop

I have tried:

  • Running console app in background by not creating a window for it and not using shell execute (doesn't work)
  • Registering events for Completed and StateChanged and trying to StartAsync recognition whenever state changes to idle, or when completed, it works halfway: For some reason if I click on my second monitor to lose focus it often works, but once in awhile still doesn't. Every single time I lose focus by clicking on the same monitor screen but elsewhere, it appears to stop working. It will still produce state changes like "Sound started" then "Speech detected" then finally "Sound ended" before producing nothing, not even the "Processing" state where its producing the result
  • It also has weirdly recognized a phrase without ever changing state. No started, detected, or ended, and not even processing. Just jumped straight to displaying the result, which was correct recognition-wise.

The thing is, part of my project is meant to be ran on a user facing app so I could move this functionality there, but I shouldn't expect the end user to have to keep that app in focus just to utilize speech to text. So its not really much of a solution.

  • That's a feature, so basically you can run in background but can't lose the focus. [This article](https://social.msdn.microsoft.com/Forums/en-US/3f0c9a2e-6d33-499b-80be-8d24f7e33c2b/c-continuous-speech-recognition-in-background) has a extensive discussion about that topic and will help you. – osfresia Jan 05 '22 at 17:38

0 Answers0