Esempio n. 1
0
 def start_async(self):
     self.state.running = True
     queue = Queue()
     AudioProducer(self.state, queue, self.microphone,
                   self.remote_recognizer, self).start()
     AudioConsumer(self.state, queue, self, STTFactory.create(),
                   self.wakeup_recognizer, self.mycroft_recognizer).start()
Esempio n. 2
0
 def start_async(self):
     self.state.running = True
     queue = Queue()
     AudioProducer(self.state, queue, self.microphone,
                   self.remote_recognizer, self).start()
     AudioConsumer(self.state, queue, self, STTFactory.create(),
                   self.wakeup_recognizer, self.mycroft_recognizer).start()
Esempio n. 3
0
 def start_async(self):
     """
         Start consumer and producer threads
     """
     self.state.running = True
     queue = Queue()
     self.producer = AudioProducer(self.state, queue, self.microphone,
                                   self.responsive_recognizer, self)
     self.producer.start()
     self.consumer = AudioConsumer(self.state, queue, self,
                                   STTFactory.create(),
                                   self.wakeup_recognizer,
                                   self.wakeword_recognizer)
     self.consumer.start()
Esempio n. 4
0
 def start_async(self):
     """
         Start consumer and producer threads
     """
     self.state.running = True
     queue = Queue()
     self.producer = AudioProducer(self.state, queue, self.microphone,
                                   self.responsive_recognizer, self)
     self.producer.start()
     self.consumer = AudioConsumer(self.state, queue, self,
                                   STTFactory.create(),
                                   self.wakeup_recognizer,
                                   self.wakeword_recognizer)
     self.consumer.start()
Esempio n. 5
0
 def run(self):
     LOG.info("Creating SST interface")
     self.stt = STTFactory.create()
     self.emitter.on("stt.request", self.handle_external_request)
     while not self.stop_event.is_set():
         if exists(self.path):
             audio = read_wave_file(self.path)
             text = self.stt.execute(audio).lower().strip()
             self.emitter.emit(
                 Message("recognizer_loop:utterance", 
                        {"utterances": [text]},
                        {"source": "wav_client"}))
             remove(self.path)
         time.sleep(0.5)
Esempio n. 6
0
 def start_async(self):
     """Start consumer and producer threads."""
     self.state.running = True
     stt = STTFactory.create()
     queue = Queue()
     stream_handler = None
     if stt.can_stream:
         stream_handler = AudioStreamHandler(queue)
     self.producer = AudioProducer(self.state, queue, self.microphone,
                                   self.responsive_recognizer, self,
                                   stream_handler)
     self.producer.start()
     self.consumer = AudioConsumer(self.state, queue, self, stt,
                                   self.wakeup_recognizer,
                                   self.wakeword_recognizer)
     self.consumer.start()
Esempio n. 7
0
 def run(self):
     LOG.info("Creating SST interface")
     self.stt = STTFactory.create()
     self.emitter.on("stt.request", self.handle_external_request)
     while not self.stop_event.is_set():
         if exists(self.path):
             try:
                 audio = read_wave_file(self.path)
                 text = self.stt.execute(audio).lower().strip()
                 self.emitter.emit(
                     Message("recognizer_loop:utterance",
                             {"utterances": [text]},
                             {"source": "wav_client"}))
                 remove(self.path)
             except Exception as e:
                 # TODO less verbose for reads during writes (ie, live recording)
                 LOG.warning(e)
                 time.sleep(0.5)
         time.sleep(0.3)
Esempio n. 8
0
    def __init__(self, factory, client, queue, sample_rate=16000):
        super().__init__()
        self.client = client
        self.factory = factory
        self.stt = STTFactory.create()
        self.sample_rate = sample_rate
        self.vad = webrtcvad.Vad(1)
        self.queue = queue

        BLOCKS_PER_SECOND = 50
        self.block_size = int(self.sample_rate /
                              float(BLOCKS_PER_SECOND))  # 320
        padding_ms = 600
        block_duration_ms = 1000 * \
                            self.block_size // self.sample_rate  # 20
        num_padding_blocks = padding_ms // block_duration_ms  # 30
        self.ratio = 0.75

        self.ring_buffer = deque(maxlen=num_padding_blocks)
        self.triggered = False
        self.running = True
 def get_stt():
     return STTFactory.create()
Esempio n. 10
0
 def __init__(self, emitter=None):
     super(FileConsumer, self).__init__()
     self.stt = None
     self.emitter = emitter
     LOG.info("Creating SST interface")
     self.stt = STTFactory.create()