Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
45 lines (32 sloc) 1.15 KB
# -*- coding: utf-8 -*-
import snowboydecoder
import sys
import signal
# Demo code for listening two hotwords at the same time
interrupted = False
import bme_remote
import camera_line
def signal_handler(signal, frame):
global interrupted
interrupted = True
def interrupt_callback():
global interrupted
return interrupted
if len(sys.argv) != 3:
print("Error: need to specify 2 model names")
print("Usage: python demo.py 1st.model 2nd.model")
sys.exit(-1)
models = sys.argv[1:]
# capture SIGINT signal, e.g., Ctrl+C
signal.signal(signal.SIGINT, signal_handler)
sensitivity = [0.5]*len(models)
detector = snowboydecoder.HotwordDetector(models, sensitivity=sensitivity)
callbacks = [lambda: camera_line.main(),
lambda: bme_remote.main()]
print("「ねぇ、お部屋チェック!」や「ねぇ、お部屋測って!」などウェイクワードを発話して下さい。Ctrl+Cで終了します。")
# main loop
# make sure you have the same numbers of callbacks and models
detector.start(detected_callback=callbacks,
interrupt_check=interrupt_callback,
sleep_time=0.03)
detector.terminate()
You can’t perform that action at this time.