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:
with sr.Microphone( deviceIndex ) as src:
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)
print(text)
return self.voiceToText(deviceIndex)
except sr.RequestError as err:
print("Unable to request results: {0}".format(err))

Loading…
Cancel
Save