Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

equalizer get_color: Better thresholding devised by Nephirus

  • Loading branch information...
commit e05a43783f57cbc641325851f26dbe46347d324f 1 parent d98a98e
Petr Baudis authored September 14, 2012

Showing 1 changed file with 6 additions and 3 deletions. Show diff stats Hide diff stats

  1. 9  host_python/equalizer.py
9  host_python/equalizer.py
@@ -81,11 +81,14 @@ def print_usage():
81 81
                 frames_per_buffer = CHUNK_SIZE)
82 82
 
83 83
 def get_color(volume):
84  
-    p = 1-15/(volume)
  84
+    vol_thres = 200
  85
+    if volume <= vol_thres: return (0, 0, 0)
  86
+    p = 1-25/(volume-vol_thres)
85 87
     if p <= 0: return (0, 0, 0)
  88
+    if p >= 1: return (1.0, 1.0, 1.0)
86 89
     # Monochromatic mode:
87  
-    # p = p * p * p * p * p * p * p
88  
-    # return (0, p/4, p) # or any other combination
  90
+    #p = p * p * p * p * p * p * p
  91
+    #return (p, p, 0) # or any other combination
89 92
     if LAZY == 1:
90 93
         p *= p
91 94
     else:

0 notes on commit e05a437

Please sign in to comment.
Something went wrong with that request. Please try again.