I made a small voice assistant 6 months ago using the voice recognition /pyttsx3 python module and it has been working for those 6 months until as of recently it seems to have stopped working. Since when I start running the script it just doesn't seem to recognize my voice and just stays at "listening" without giving any response or error message at all.Also, I tried uninstalling/reinstalling the modules,but that didn't change anything and I have tried looking online to see if someonelse had a similar issue,but I wasn't able to find anything resembling the problem that I have.
Here is the function which I made for the voice recognition/response from my voice assistant:
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[0].id)
def takeCommand():
r = sr.Recognizer()
with sr.Microphone() as source:
speak("Listening...")
print("Listening...")
audio = r.listen(source)
try:
print("Recognizing...")
query = r.recognize_google(audio, language = 'en-us')
print(f"user said: {query}\n")
except Exception as e:
print(e)
print("Say that again please")
query = None
return query
Any help would be greatly appreciated,Thanks -Obunga