Intel Edison ボードで pyaudio を試していますが、組み込みテストで失敗します。私の設定では、録音と再生だけでは問題なく動作しますが、入力を出力に接続しようとすると、エラーが発生します。
ファイル「wire_full.py」、33 行目、data = stream.read(CHUNK) ファイル「/usr/lib/python2.7/site-packages/pyaudio.py」、605 行目、読み取り return pa.read_stream(self ._stream, num_frames) IOError: [Errno 入力オーバーフロー] -9981
誰が問題が何であるかを理解していますか?
以下は、pyaudio で入力を出力に接続するためのサンプル コードです。
"""
PyAudio Example: Make a wire between input and output (i.e., record a
few samples and play them back immediately).
This is the full duplex version.
"""
import pyaudio
import sys
CHUNK = 1024
WIDTH = 2
CHANNELS = 2
RATE = 44100
RECORD_SECONDS = 5
if sys.platform == 'darwin':
CHANNELS = 1
p = pyaudio.PyAudio()
stream = p.open(format=p.get_format_from_width(WIDTH),
channels=CHANNELS,
rate=RATE,
input=True,
output=True,
frames_per_buffer=CHUNK)
print("* recording")
for i in range(0, int(RATE / CHUNK * RECORD_SECONDS)):
data = stream.read(CHUNK)
stream.write(data, CHUNK)
print("* done")
stream.stop_stream()
stream.close()
p.terminate()