def run(self):
pya = PyAudio()
self._stream = pya.open(
format=paInt16,
channels=1,
rate=SAMPLE_RATE,
input=True,
frames_per_buffer=WINDOW_SIZE,
stream_callback=self._process_frame,
)
self._stream.start_stream()
while self._stream.is_active() and not raw_input():
time.sleep(0.1)
self._stream.stop_stream()
self._stream.close()
pya.terminate()
评论列表
文章目录