Closed janvda closed 6 years ago
I did some further research and it seems that my raspberry pi is not able to read the stream of audio quickly enough resulting in this buffer overflow exception.
https://people.csail.mit.edu/hubert/pyaudio/docs/#pyaudio.Stream.read
I fixed the issue by reducing the (sampling) rate from 44000 to 16000. This assured that my raspberry pi is able to keep up with the processing of the audio stream so that we no longer get this buffer overflow error.
I did this by creating a config file ~/.soundmeter/config
with the following content (it is important that the rate is set to 16000 and not 44000)
[soundmeter]
frames_per_buffer = 2048
format = 8
channels = 2
rate = 16000
audio_segment_length = 0.5
rms_as_trigger_arg = False
I have had the same issue on my raspberry pi that I could not fix by reducing the sampling rate or by increasing the frames_per_buffer value (which is suggested elsewhere).
However, setting exception_on_overflow=False (default is true)
https://people.csail.mit.edu/hubert/pyaudio/docs/#pyaudio.Stream.read
Has fixed it for me
How did you do that?
you need to edit a line in pyaudio.py to read:
def read(self, num_frames, exception_on_overflow=False):
in my installation pyaudio.py is installed here:
/home/pi/.local/lib/python2.7/site-packages/pyaudio.py
and it is line 589
Thank you!!
I get the below error when running soundmeter on my raspberry pi. It doesn't take long to get the error (a few seconds up to a few minutes).