コード例 #1
0
    def listen(self):
        conf_manager = ConfigurationManager()
        config = conf_manager.instance()

        detector = hotword_detectors[config['HOTWORD_ENGINE']](
            self.detected_callback)
        detector.listen()
コード例 #2
0
ファイル: main.py プロジェクト: pink-goose/Proteus_client
def detected_callback():
    logger.info('Hotword detected')
    player = AudioPlayer()
    conf_manager = ConfigurationManager()
    config = conf_manager.instance()
    player.play(config['DETECT_SOUND'])
    recorder = Recorder()
    recorded_file = recorder.record()
    requester = ProteusRequests()
    try:
        answer_audio = requester.speech_audio(recorded_file)
    except Exception:
        logger.error('Connection Error: server unreachable')
        return
    logger.info('Playing...')
    player.play(answer_audio)