From e05a43783f57cbc641325851f26dbe46347d324f Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Fri, 14 Sep 2012 22:41:20 +0200 Subject: [PATCH] equalizer get_color: Better thresholding devised by Nephirus --- host_python/equalizer.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/host_python/equalizer.py b/host_python/equalizer.py index 28279d6..687d7d8 100755 --- a/host_python/equalizer.py +++ b/host_python/equalizer.py @@ -81,11 +81,14 @@ stream = p.open(format = FORMAT, frames_per_buffer = CHUNK_SIZE) def get_color(volume): - p = 1-15/(volume) + vol_thres = 200 + if volume <= vol_thres: return (0, 0, 0) + p = 1-25/(volume-vol_thres) if p <= 0: return (0, 0, 0) + if p >= 1: return (1.0, 1.0, 1.0) # Monochromatic mode: - # p = p * p * p * p * p * p * p - # return (0, p/4, p) # or any other combination + #p = p * p * p * p * p * p * p + #return (p, p, 0) # or any other combination if LAZY == 1: p *= p else: