示例#1
0
    def test2Array(self):
        try:
            if self.config.has_key("2array_mic_hat"):
                sys.path.append(self.config["2array_mic_hat"])
                from pixels import Pixels
                pixels = Pixels()
                pixels.wakeup()
                time.sleep(3)
                pixels.off()
                time.sleep(2)
                pixels.think()
                time.sleep(3)
                for i in range(0, 5):
                    pixels.speak()
                    time.sleep(1)

                pixels.off()
                time.sleep(1)
        except Exception as e:
            print e.message
示例#2
0
    fh.setFormatter(formatter)
    logger.addHandler(fh)

    while True:
        file_name = a.process(3)
        logger.info("wake_word said :: " + recognized_text)
        #print("wake_word said :: " + recognized_text)
        if "Gideon" in recognized_text:
            logger.info("wake word detected...")
            recognized_text = ''
            px.wakeup()
            valib.audio_playback('how can i help you')
            time.sleep(0.5)
            command_file_name = a.process(5)
            a.voice_command_processor(command_file_name)
            logger.info("you said :: " + recognized_text)
            px.think()
            status = response.process_text(recognized_text, a)
            while status != 'done':
                pass

            files = glob.glob(os.path.join(WAVE_OUTPUT_FILEPATH + '*.wav'))
            for file in files:
                os.remove(file)
            recognized_text = ''
            px.off()
        else:
            t1 = threading.Thread(target=a.voice_command_processor,
                                  args=(file_name, ))
            t1.start()