Beispiel #1
0
    def __init__(self):
        self.running = False
        self.news = NewsReader()
        self.thread_queue = Queue()
        self.voice_parser = VoiceInputParser(self)
        self.clap_detector = ClapDetector(self.thread_queue)
        self.cur_speech_process = None
        self.speech_q = Queue()
        self.last_update = datetime.now()
        self.alarms = []
        self.alarm_tones = []
        self.alarm_index = 0
        self.cur_alarm_process = None
        self.state = States.Idle

        self.weather = Weather()
Beispiel #2
0
            clap = self.check_clap(frame_data)
            if clap:
                print 'Clapped'
                self.thread_queue.put('clap')
                self.stop()

    except (KeyboardInterrupt, SystemExit):
        print "\rExiting"
        self.stream.stop_stream()
        self.stream.close()
        self.p.terminate()

speak('hi')
q = Queue()
cd = ClapDetector(q)
cd.start()

while q.empty():
    pass
q.get()
speak('hello')
cd.start()

while q.empty():
    pass

import io, os, subprocess, wave, base64
import math, audioop, collections, threading
import platform, stat
import json