Led music visualizer spectrum effect

Thread Starter

Dabu WhiteHacker

Joined Sep 5, 2017
68
Hy i working on led music visualizer project an app on andriod And will get music data and process it and then send data to esp8266 which will drive apa102 leds
I want spectrum animation as shown in this video
He is using python to process music data, i was able to find the piece of code where he is making spectrum animation
 

Thread Starter

Dabu WhiteHacker

Joined Sep 5, 2017
68
Here is his code
Code:
def visualize_spectrum(y):
    """Effect that maps the Mel filterbank frequencies onto the LED strip"""
    global _prev_spectrum
    y = np.copy(interpolate(y, config.N_PIXELS // 2))
    common_mode.update(y)
    diff = y - _prev_spectrum
    _prev_spectrum = np.copy(y)
    # Color channel mappings
    r = r_filt.update(y - common_mode.value)
    g = np.abs(diff)
    b = b_filt.update(np.copy(y))
    # Mirror the color channels for symmetric output
    r = np.concatenate((r[::-1], r))
    g = np.concatenate((g[::-1], g))
    b = np.concatenate((b[::-1], b))
    output = np.array([r, g,b]) * 255
    return output
 
Top