(self)
Start processing the queue.
Start processing the queue.
Start processing the queue .
def start(self):
    """Start processing the queue."""
    with self._recorder:
      timed_out = False
      while not timed_out:
        assert self._recorder.is_active
        new_audio = self._recorder.get_audio(self._frame_length -
                                             len(self._audio_buffer))
        audio_samples = np.concatenate(
            (self._audio_buffer, new_audio[0] * FLAGS.mic_amplify))

        # Extract overlapping
        first_unused_byte = 0
        for pos in range(0, audio_samples.shape[0] - self._frame_length,
                         self._frame_length - self._overlap):
          self._callback(
              AudioChunk(self._chunk_counter,
                         audio_samples[pos:pos + self._frame_length]))
          self._chunk_counter += 1
          first_unused_byte = pos + self._frame_length

        # Keep the remaining bytes for next time
        self._audio_buffer = audio_samples[first_unused_byte:]
def start ( self ) : with self . _recorder : timed_out = False while not timed_out : assert self . _recorder . is_active new_audio = self . _recorder . get_audio ( self . _frame_length - len ( self . _audio_buffer ) ) audio_samples = np . concatenate ( ( self . _audio_buffer , new_audio [ 0 ] * FLAGS . mic_amplify ) ) # Extract overlapping first_unused_byte = 0 for pos in range ( 0 , audio_samples . shape [ 0 ] - self . _frame_length , self . _frame_length - self . _overlap ) : self . _callback ( AudioChunk ( self . _chunk_counter , audio_samples [ pos : pos + self . _frame_length ] ) ) self . _chunk_counter += 1 first_unused_byte = pos + self . _frame_length # Keep the remaining bytes for next time self . _audio_buffer = audio_samples [ first_unused_byte : ]