shichao-an / soundmeter

Simple real-time sound meter
https://soundmeter.shichao.io
BSD 2-Clause "Simplified" License
82 stars 27 forks source link

[Errno -9981] Input overflowed #27

Open andreaskoeberl opened 5 years ago

andreaskoeberl commented 5 years ago

Hi,

I'm trying to run soundmeter indefinitely on my Mac Mini using the command soundmeter -t +XXX 2 -a exec-stop -e xyz.sh When I started this last night and checked on it this morning, soundmeter seemed to have crashed and executed the script although the trigger was never reached. I got the following error in terminal:

1549 Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.6/bin/soundmeter", line 11, in load_entry_point('soundmeter==0.1.5', 'console_scripts', 'soundmeter')() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/soundmeter/meter.py", line 322, in main m.start() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/soundmeter/meter.py", line 124, in start record.send(True) # Record stream `AUDIO_SEGMENT_LENGTH' long File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/soundmeter/meter.py", line 95, in record data = self.stream.read(self.config.FRAMES_PER_BUFFER) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyaudio.py", line 608, in read return pa.read_stream(self._stream, num_frames, exception_on_overflow) OSError: [Errno -9981] Input overflowed

Any idea what could be causing that and how to prevent it?

My intention is to run soundmeter to detect input from a record player and then automatically configure the sound output to play on my speakers (done in the shell script). The script works, but due to the failure, the speakers got misconfigured and the automation stops...

rastafioul commented 5 years ago

The solution I used is, after having changed default config (in .soundmeter/config) to:

[soundmeter]
frames_per_buffer = 2048
format = 8
channels = 1
rate = 44100
audio_segment_length = 0.5
rms_as_trigger_arg = False

in (/WHERE_YOUR_LIB_IS/)lib/python2.7/site-packages/soundmeter/meter.py line 95, change to:

data = self.stream.read(self.config.FRAMES_PER_BUFFER, exception_on_overflow = False)

BlenderVali commented 4 years ago

The solution I used is, after having changed default config (in .soundmeter/config) to:

[soundmeter]
frames_per_buffer = 2048
format = 8
channels = 1
rate = 44100
audio_segment_length = 0.5
rms_as_trigger_arg = False

in (/WHERE_YOUR_LIB_IS/)lib/python2.7/site-packages/soundmeter/meter.py line 95, change to:

data = self.stream.read(self.config.FRAMES_PER_BUFFER, exception_on_overflow = False)

Works, Tested on a Raspberry Pi 3b with a Mic attached via USB