def main(): global client global loop client = WebsocketClient() device_index = config.get('speech_client').get('device_index') if device_index: device_index = int(device_index) loop = RecognizerLoop(device_index=device_index) loop.on('recognizer_loop:utterance', handle_utterance) loop.on('recognizer_loop:record_begin', handle_record_begin) loop.on('recognizer_loop:wakeword', handle_wakeword) loop.on('recognizer_loop:record_end', handle_record_end) loop.on('speak', handle_speak) client.on('speak', handle_speak) client.on( 'multi_utterance_intent_failure', handle_multi_utterance_intent_failure) client.on('recognizer_loop:sleep', handle_sleep) client.on('recognizer_loop:wake_up', handle_wake_up) client.on('mycroft.stop', handle_stop) event_thread = Thread(target=connect) event_thread.setDaemon(True) event_thread.start() try: subprocess.call('echo "eyes.reset" >/dev/ttyAMA0', shell=True) except: pass try: loop.run() except KeyboardInterrupt, e: logger.exception(e) event_thread.exit() sys.exit()
def main(): global ws global loop ws = WebsocketClient() tts.init(ws) ConfigurationManager.init(ws) loop = RecognizerLoop() loop.on('recognizer_loop:utterance', handle_utterance) loop.on('recognizer_loop:record_begin', handle_record_begin) loop.on('recognizer_loop:wakeword', handle_wakeword) loop.on('recognizer_loop:record_end', handle_record_end) loop.on('speak', handle_speak) ws.on('open', handle_open) ws.on('speak', handle_speak) ws.on( 'multi_utterance_intent_failure', handle_multi_utterance_intent_failure) ws.on('recognizer_loop:sleep', handle_sleep) ws.on('recognizer_loop:wake_up', handle_wake_up) ws.on('mycroft.stop', handle_stop) ws.on("mycroft.paired", handle_paired) event_thread = Thread(target=connect) event_thread.setDaemon(True) event_thread.start() try: loop.run() except KeyboardInterrupt, e: logger.exception(e) event_thread.exit() sys.exit()
def main(): global ws global loop ws = WebsocketClient() tts.init(ws) ConfigurationManager.init(ws) loop = RecognizerLoop() loop.on('recognizer_loop:utterance', handle_utterance) loop.on('recognizer_loop:record_begin', handle_record_begin) loop.on('recognizer_loop:wakeword', handle_wakeword) loop.on('recognizer_loop:record_end', handle_record_end) loop.on('speak', handle_speak) ws.on('open', handle_open) ws.on('speak', handle_speak) ws.on('multi_utterance_intent_failure', handle_multi_utterance_intent_failure) ws.on('recognizer_loop:sleep', handle_sleep) ws.on('recognizer_loop:wake_up', handle_wake_up) ws.on('mycroft.stop', handle_stop) ws.on("mycroft.paired", handle_paired) event_thread = Thread(target=connect) event_thread.setDaemon(True) event_thread.start() try: loop.run() except KeyboardInterrupt, e: logger.exception(e) event_thread.exit() sys.exit()
def main(): global ws global loop global config lock = PIDLock("voice") ws = WebsocketClient() config = ConfigurationManager.get() ConfigurationManager.init(ws) loop = RecognizerLoop() loop.on('recognizer_loop:utterance', handle_utterance) loop.on('recognizer_loop:record_begin', handle_record_begin) loop.on('recognizer_loop:wakeword', handle_wakeword) loop.on('recognizer_loop:record_end', handle_record_end) loop.on('recognizer_loop:no_internet', handle_no_internet) ws.on('open', handle_open) ws.on('multi_utterance_intent_failure', handle_multi_utterance_intent_failure) ws.on('recognizer_loop:sleep', handle_sleep) ws.on('recognizer_loop:wake_up', handle_wake_up) ws.on('mycroft.mic.mute', handle_mic_mute) ws.on('mycroft.mic.unmute', handle_mic_unmute) ws.on("mycroft.paired", handle_paired) ws.on('recognizer_loop:audio_output_start', handle_audio_start) ws.on('recognizer_loop:audio_output_end', handle_audio_end) event_thread = Thread(target=connect) event_thread.setDaemon(True) event_thread.start() try: loop.run() except KeyboardInterrupt, e: logger.exception(e) sys.exit()
def main(): global client global loop client = WebsocketClient() device_index = config.get('speech_client').get('device_index') if device_index: device_index = int(device_index) loop = RecognizerLoop(device_index=device_index) loop.on('recognizer_loop:utterance', handle_utterance) loop.on('recognizer_loop:record_begin', handle_record_begin) loop.on('recognizer_loop:wakeword', handle_wakeword) loop.on('recognizer_loop:record_end', handle_record_end) loop.on('speak', handle_speak) client.on('speak', handle_speak) client.on('multi_utterance_intent_failure', handle_multi_utterance_intent_failure) client.on('recognizer_loop:sleep', handle_sleep) client.on('recognizer_loop:wake_up', handle_wake_up) client.on('mycroft.stop', handle_stop) event_thread = Thread(target=connect) event_thread.setDaemon(True) event_thread.start() try: subprocess.call('echo "eyes.reset" >/dev/ttyAMA0', shell=True) except: pass try: loop.run() except KeyboardInterrupt, e: logger.exception(e) event_thread.exit() sys.exit()
def main(): global client global loop client = WebsocketClient() device_index = config.get('speech_client').get('device_index') if device_index: device_index = int(device_index) loop = RecognizerLoop(device_index=device_index) loop.on('recognizer_loop:listening', handle_listening) loop.on('recognizer_loop:wakeword', handle_wakeword) loop.on('recognizer_loop:utterance', handle_utterance) loop.on('speak', handle_speak) client.on('speak', handle_speak) client.on( 'multi_utterance_intent_failure', handle_multi_utterance_intent_failure) client.on('recognizer_loop:sleep', handle_sleep) client.on('recognizer_loop:wake_up', handle_wake_up) event_thread = Thread(target=connect) event_thread.setDaemon(True) event_thread.start() try: loop.run() except KeyboardInterrupt, e: event_thread.exit() sys.exit()
def main(): global client global loop client = WebsocketClient() device_index = config.get('speech_client').get('device_index') if device_index: device_index = int(device_index) loop = RecognizerLoop(device_index=device_index) loop.on('recognizer_loop:listening', handle_listening) loop.on('recognizer_loop:wakeword', handle_wakeword) loop.on('recognizer_loop:utterance', handle_utterance) loop.on('speak', handle_speak) client.on('speak', handle_speak) client.on('multi_utterance_intent_failure', handle_multi_utterance_intent_failure) client.on('recognizer_loop:sleep', handle_sleep) client.on('recognizer_loop:wake_up', handle_wake_up) event_thread = Thread(target=connect) event_thread.setDaemon(True) event_thread.start() try: loop.run() except KeyboardInterrupt, e: event_thread.exit() sys.exit()
def main(): global ws global loop global config lock = PIDLock("voice") ws = WebsocketClient() config = Configuration.get() Configuration.init(ws) loop = RecognizerLoop() loop.on('recognizer_loop:utterance', handle_utterance) loop.on('speak', handle_speak) loop.on('recognizer_loop:record_begin', handle_record_begin) loop.on('recognizer_loop:wakeword', handle_wakeword) loop.on('recognizer_loop:record_end', handle_record_end) loop.on('recognizer_loop:no_internet', handle_no_internet) ws.on('open', handle_open) ws.on('complete_intent_failure', handle_complete_intent_failure) ws.on('recognizer_loop:sleep', handle_sleep) ws.on('recognizer_loop:wake_up', handle_wake_up) ws.on('mycroft.mic.mute', handle_mic_mute) ws.on('mycroft.mic.unmute', handle_mic_unmute) ws.on("mycroft.paired", handle_paired) ws.on('recognizer_loop:audio_output_start', handle_audio_start) ws.on('recognizer_loop:audio_output_end', handle_audio_end) ws.on('mycroft.stop', handle_stop) event_thread = Thread(target=connect) event_thread.setDaemon(True) event_thread.start() try: loop.run() except KeyboardInterrupt, e: LOG.exception(e) sys.exit()
def main(): global bus global loop global config reset_sigint_handler() PIDLock("voice") bus = WebsocketClient() # Mycroft messagebus, see mycroft.messagebus Configuration.init(bus) config = Configuration.get() # Register handlers on internal RecognizerLoop bus loop = RecognizerLoop() loop.on('recognizer_loop:utterance', handle_utterance) loop.on('recognizer_loop:speech.recognition.unknown', handle_unknown) loop.on('speak', handle_speak) loop.on('recognizer_loop:record_begin', handle_record_begin) loop.on('recognizer_loop:awoken', handle_awoken) loop.on('recognizer_loop:wakeword', handle_wakeword) loop.on('recognizer_loop:record_end', handle_record_end) loop.on('recognizer_loop:no_internet', handle_no_internet) # Register handlers for events on main Mycroft messagebus bus.on('open', handle_open) bus.on('complete_intent_failure', handle_complete_intent_failure) bus.on('recognizer_loop:sleep', handle_sleep) bus.on('recognizer_loop:wake_up', handle_wake_up) bus.on('mycroft.mic.mute', handle_mic_mute) bus.on('mycroft.mic.unmute', handle_mic_unmute) bus.on('mycroft.mic.get_status', handle_mic_get_status) bus.on("mycroft.paired", handle_paired) bus.on('recognizer_loop:audio_output_start', handle_audio_start) bus.on('recognizer_loop:audio_output_end', handle_audio_end) bus.on('mycroft.stop', handle_stop) create_daemon(bus.run_forever) create_daemon(loop.run) wait_for_exit_signal()
def main(): global ws global loop reset_sigint_handler() PIDLock("voice") ws = WebsocketClient() Configuration.init(ws) loop = RecognizerLoop() loop.on('recognizer_loop:utterance', handle_utterance) loop.on('recognizer_loop:speech.recognition.unknown', handle_unknown) loop.on('speak', handle_speak) loop.on('recognizer_loop:record_begin', handle_record_begin) loop.on('recognizer_loop:awoken', handle_awoken) loop.on('recognizer_loop:wakeword', handle_wakeword) loop.on('recognizer_loop:record_end', handle_record_end) loop.on('recognizer_loop:no_internet', handle_no_internet) ws.on('open', handle_open) ws.on('complete_intent_failure', handle_complete_intent_failure) ws.on('recognizer_loop:sleep', handle_sleep) ws.on('recognizer_loop:wake_up', handle_wake_up) ws.on('mycroft.mic.mute', handle_mic_mute) ws.on('mycroft.mic.unmute', handle_mic_unmute) ws.on('mycroft.mic.get_status', handle_mic_get_status) ws.on("mycroft.paired", handle_paired) ws.on('recognizer_loop:audio_output_start', handle_audio_start) ws.on('recognizer_loop:audio_output_end', handle_audio_end) ws.on('mycroft.stop', handle_stop) create_daemon(ws.run_forever) create_daemon(loop.run) wait_for_exit_signal()
def main(): global ws global loop ws = WebsocketClient() tts.init(ws) ConfigurationManager.init(ws) loop = RecognizerLoop() loop.on('recognizer_loop:utterance', handle_utterance) loop.on('recognizer_loop:record_begin', handle_record_begin) loop.on('recognizer_loop:waiting_for_wakeword', handle_waiting_for_wakeword) loop.on('recognizer_loop:wakeword', handle_wakeword) loop.on('recognizer_loop:record_end', handle_record_end) loop.on('recognizer_loop:tooshort', handle_tooshort) loop.on('speak', handle_speak) ws.on('open', handle_open) ws.on('speak', handle_speak) ws.on('multi_utterance_intent_failure', handle_multi_utterance_intent_failure) ws.on('recognizer_loop:sleep', handle_sleep) ws.on('recognizer_loop:mute', handle_mute) ws.on('recognizer_loop:wake_up', handle_wake_up) ws.on('mycroft.stop', handle_stop) ws.on("mycroft.paired", handle_paired) event_thread = Thread(target=connect) event_thread.setDaemon(True) event_thread.start() #tts.execute("Hello! I am Teddy, your TV watching companion.") tts.execute("To get my attention, say Hey Teddy!") try: loop.run() except KeyboardInterrupt, e: logger.exception(e) event_thread.exit() sys.exit()
def main(): global ws global loop global config global tts global tts_hash lock = PIDLock("voice") ws = WebsocketClient() config = ConfigurationManager.get() tts = TTSFactory.create() tts.init(ws) tts_hash = config.get('tts') ConfigurationManager.init(ws) loop = RecognizerLoop() loop.on('recognizer_loop:utterance', handle_utterance) loop.on('recognizer_loop:record_begin', handle_record_begin) loop.on('recognizer_loop:wakeword', handle_wakeword) loop.on('recognizer_loop:record_end', handle_record_end) loop.on('speak', handle_speak) loop.on('recognizer_loop:no_internet', handle_no_internet) ws.on('open', handle_open) ws.on('speak', handle_speak) ws.on( 'multi_utterance_intent_failure', handle_multi_utterance_intent_failure) ws.on('recognizer_loop:sleep', handle_sleep) ws.on('recognizer_loop:wake_up', handle_wake_up) ws.on('mycroft.mic.mute', handle_mic_mute) ws.on('mycroft.mic.unmute', handle_mic_unmute) ws.on('mycroft.stop', handle_stop) ws.on("mycroft.paired", handle_paired) ws.on('recognizer_loop:audio_output_start', handle_audio_start) ws.on('recognizer_loop:audio_output_end', handle_audio_end) event_thread = Thread(target=connect) event_thread.setDaemon(True) event_thread.start() try: loop.run() except KeyboardInterrupt, e: tts.playback.stop() tts.playback.join() logger.exception(e) sys.exit()