Browse Source

#14 merge tts/clips into audio_output

Martin 10 năm trước cách đây
mục cha
commit
16ab68b9d7
1 tập tin đã thay đổi với 8 bổ sung và 9 xóa
  1. 8 9
      voice_control/trigger.py

+ 8 - 9
voice_control/trigger.py

@@ -1,9 +1,8 @@
 import logging
-import snowboy.snowboydecoder
-import sys
+#import snowboy.snowboydecoder
 import signal
 import ears
-import tts
+import output
 
 # Demo code for listening two hotwords at the same time
 
@@ -36,7 +35,7 @@ def _callback(model):
             if keyword in model['callbacks']:
                 return model['callbacks'][keyword].call(trigger=keyword, additional_tokens=tokens[1:])
     
-    tts.tts('callback failed.')
+    output.failure()
 
 def loop_model(model):
     signal.signal(signal.SIGINT, _signal_handler)
@@ -57,11 +56,11 @@ def start(models):
     logging.info('Launching Snowboy hotword detector...')
     signal.signal(signal.SIGINT, _signal_handler)
 
-    detector = snowboy.snowboydecoder.HotwordDetector(decoder_model=models[0]['model'],
-                                                      resource='/home/martin/workspaces/visual-code/voice_control/resources/snowboy/common.res', 
-                                                      sensitivity=DEFAULT_SENSITIVITY)
+    #detector = snowboy.snowboydecoder.HotwordDetector(decoder_model=models[0]['model'],
+    #                                                  resource='/home/martin/workspaces/visual-code/voice_control/resources/snowboy/common.res', 
+    #                                                  sensitivity=DEFAULT_SENSITIVITY)
 
     logging.info('Stream opened.')
 
-    detector.start(detected_callback=callbacks[0], interrupt_check=_interrupt_callback, sleep_time=0.03)
-    detector.terminate()
+    #detector.start(detected_callback=callbacks[0], interrupt_check=_interrupt_callback, sleep_time=0.03)
+    #detector.terminate()