From c61db1b140ffb184509b4efb4e306d7169881eef Mon Sep 17 00:00:00 2001 From: kanapoutz78 Date: Tue, 19 Dec 2017 16:50:24 +0100 Subject: [PATCH] Fix overflow bug for Raspberry Pi As fixed at : https://github.com/scottlawsonbc/audio-reactive-led-strip/pull/73 --- python/microphone.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/microphone.py b/python/microphone.py index 66d6b80..305003b 100644 --- a/python/microphone.py +++ b/python/microphone.py @@ -16,8 +16,9 @@ def start_stream(callback): prev_ovf_time = time.time() while True: try: - y = np.fromstring(stream.read(frames_per_buffer), dtype=np.int16) + y = np.fromstring(stream.read(frames_per_buffer, exception_on_overflow=False), dtype=np.int16) y = y.astype(np.float32) + stream.read(get_read_available(), exception_on_overflow=False) callback(y) except IOError: overflows += 1