Created
February 27, 2019 13:51
-
-
Save jiansoo/b0577343b5030ca1aa89b85e30b19316 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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