Okay so I tried using pyttxs3 and speech_recognition in a noisy area and my code took a lot of time to run, i assume that it was constantly taking the noise as input. So i was wondering if it is possible to give a timer, for example if it is more than 2 mins it should stop taking input and run the code or if it hears a particular word like okay
it should stop taking input.
this is a sample of my code: import speech_recognition as sr import pyttsx3
r = sr.Recognizer()
with sr.Microphone() as source:
print('Talk to me')
audio =r.listen(source)
text = r.recognize_google(audio)
print('You said: ', text)
engine = pyttsx3.init()
engine.say("You said" + text)
engine.runAndWait()