I'm trying out pyaudio on Intel Edison board, but it fails with the build-in tests. Recording and playing alone works fine with my setting, but if I'm trying to wire input to output, it gives an error.
File "wire_full.py", line 33, in data = stream.read(CHUNK) File "/usr/lib/python2.7/site-packages/pyaudio.py", line 605, in read return pa.read_stream(self._stream, num_frames) IOError: [Errno Input overflowed] -9981
Does anybody understand what's the problem?
Below is the example code for wiring input to output in 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()