2 from six.moves
import queue
10 """Opens a recording stream as a generator yielding the audio chunks.""" 22 format=pyaudio.paInt16,
23 channels=1, rate=self.
_rate,
24 input=
True, frames_per_buffer=self.
_chunk,
36 self._audio_stream.stop_stream()
37 self._audio_stream.close()
42 self._audio_interface.terminate()
44 def _fill_buffer(self, in_data, frame_count, time_info, status_flags):
45 """Continuously collect data from the audio stream, into the buffer.""" 46 self._buff.put(in_data)
47 return None, pyaudio.paContinue
54 chunk = self._buff.get()
62 chunk = self._buff.get(block=
False)
def _fill_buffer(self, in_data, frame_count, time_info, status_flags)
def __init__(self, rate=RATE, chunk=CHUNK)
def __exit__(self, type, value, traceback)