Added recursive listening hehe

fetchIP
E. Almqvist 4 years ago
parent 3564a5e028
commit df5301d0b6
  1. 6
      speech/speech.py

@ -9,10 +9,14 @@ class voiceInput(object):
try: try:
with sr.Microphone( deviceIndex ) as src: with sr.Microphone( deviceIndex ) as src:
self.recognizer.adjust_for_ambient_noise( src, 0.2 ) self.recognizer.adjust_for_ambient_noise( src, 0.2 )
audio = self.recognizer.listen( src ) print("Listening...")
audio = self.recognizer.listen( src, phrase_time_limit=5 )
print("Thinking...")
text = self.recognizer.recognize_google(audio) text = self.recognizer.recognize_google(audio)
print(text) print(text)
return self.voiceToText(deviceIndex)
except sr.RequestError as err: except sr.RequestError as err:
print("Unable to request results: {0}".format(err)) print("Unable to request results: {0}".format(err))

Loading…
Cancel
Save