سؤال

How can i remove windows commands from pyspeech windows recognition? For example if i wanted for my program to open up notepad i would say "Open notepad", but then windows will also open up notepad for me too. How can i disable this so that my program is the only one running commands? Thank you

هل كانت مفيدة؟

المحلول

You need to change PySpeech a bit.

Try changing

_recognizer = win32com.client.Dispatch("SAPI.SpSharedRecognizer")

to

_recognizer = win32com.client.Dispatch("SAPI.SpInprocRecognizer")

نصائح أخرى

Not sure if you're still looking for the answer or not but I found it for you!

On line 66 change the code to:

_recognizer = win32com.client.Dispatch("SAPI.SpInProcRecognizer")
_recognizer.AudioInputStream = win32com.client.Dispatch("SAPI.SpMMAudioIn")

And on line 112 change the code to:

_ListenerBase = win32com.client.getevents("SAPI.SpInProcRecoContext") 

This should prevent the windows commands from running while also not showing the widget which comes up. Good luck!

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top