This program runs by applying threading. We use the microphone object to obtain speech input. We call wakeup() to activate the ReSpeaker board in order to listen to incoming speech:
mic = Microphone(quit_event=quit_event) while not quit_event.is_set(): if mic.wakeup('respeaker'): print('Wake up')
After waking up ReSpeaker, we can listen to speech and perform recognition by calling the recognize() function:
data = mic.listen()
text = mic.recognize(data)
if text:
print('Recognized %s' % text)