Skip to content

Instantly share code, notes, and snippets.

@jiansoo
Created February 27, 2019 13:51
Show Gist options
  • Save jiansoo/b0577343b5030ca1aa89b85e30b19316 to your computer and use it in GitHub Desktop.
Save jiansoo/b0577343b5030ca1aa89b85e30b19316 to your computer and use it in GitHub Desktop.
import signal
import snowboydecoder
interrupted = False
def interrupt_func(signal, frame):
global interrupted
interrupted = True
def interrupt_callback():
global interrupted
return interrupted
def start_speech_recognition():
print('Speech recognition started!')
signal.signal(signal.SIGINT, interrupt_func)
detector = snowboydecoder.HotwordDetector('Athena.pmdl', sensitivity=0.5)
detector.start(detected_callback=start_speech_recognition,
interrupt_check=interrupt_callback,
sleep_time=0.03)
detector.terminate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment