falkey
parent
3adc1d0efa
commit
36e7a42b69
|
|
@ -77,8 +77,8 @@ class Listener():
|
|||
mic_timeout=int(environ.get("MIC_TIMEOUT", 5))
|
||||
# obtain audio from the microphone
|
||||
r = sr.Recognizer()
|
||||
#return r.listen(self.mic(), timeout=mic_timeout, phrase_time_limit=mic_timeout)
|
||||
return r.record(self.mic(), duration=mic_timeout)
|
||||
return r.listen(self.mic(), timeout=mic_timeout, phrase_time_limit=mic_timeout)
|
||||
#return r.record(self.mic(), duration=mic_timeout)
|
||||
|
||||
q = queue.Queue(maxsize=1)
|
||||
l = Listener()
|
||||
|
|
@ -89,8 +89,11 @@ try:
|
|||
while True:
|
||||
got = l.run()
|
||||
q.put(got)
|
||||
if not got:
|
||||
break
|
||||
except Exception:
|
||||
pass
|
||||
finally:
|
||||
if l._mic:
|
||||
l._mic.__exit__(None, None, None)
|
||||
t.join()
|
||||
|
|
|
|||
Loading…
Reference in New Issue