From ca762a30f18289d747f9187fdc51cab899a9d37e Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Fri, 14 Sep 2012 22:42:32 +0200 Subject: [PATCH] equalizer: Fix loss of intensity in higher frequencies due to wider ranges --- host_python/equalizer.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/host_python/equalizer.py b/host_python/equalizer.py index 687d7d8..b6e7264 100755 --- a/host_python/equalizer.py +++ b/host_python/equalizer.py @@ -127,6 +127,7 @@ try: i += 1 freq += FREQ_STEP freq_limit *= PIXEL_FREQ_RANGE + freq_steps = 1 pixel = 0 count = 0 volumes = [] @@ -136,9 +137,10 @@ try: total += abs(fft[i])**2 i += 1; count += 1 freq += FREQ_STEP - volume = (total/count)**0.5/SAMPLE_SIZE - volumes.append(volume) + volume = (total/count)**0.5 + volumes.append(volume/SAMPLE_SIZE*freq_steps) freq_limit *= PIXEL_FREQ_RANGE + freq_steps += 1 pixel += 1 count = 0 for pixel in xrange(EPIXELS):