Exemplo n.º 1
0
    def setupSignal(self, signal):
        def LEDWall(s):
            lights = [s.avg6[i] * 150 / max(0.5, s.longavg6[i]) \
                            for i in range(0, 6)]

            lights.reverse()
            return lights
        
        def beats(s):
            return numpymap(lambda (a, b): 1 if a > b * 1.414 else 0, zip(s.avg6, s.longavg6))
        signal.woofers = signalutil.blend(beats, 0.7)
        signal.ledwall = lift(LEDWall)
Exemplo n.º 2
0
    def setupSignal(self, signal):
        def LEDWall(s):
            lights = [s.avg6[i] * 150 / max(0.5, s.longavg6[i]) \
                            for i in range(0, 6)]

            lights.reverse()
            return lights

        def beats(s):
            return numpymap(lambda (a, b): 1 if a > b * 1.414 else 0,
                            zip(s.avg6, s.longavg6))

        signal.woofers = signalutil.blend(beats, 0.7)  #Beats
        signal.ledwall = lift(LEDWall)
Exemplo n.º 3
0
    # quick note: s.avg4 is a decaying 4 channel fft
    #             s.longavg4 decays at a slower rate
    # beat detection huristic:
    #       beat occured if s.avg4 * threshold > s.longavg4

    threshold = 1.7
    return util.numpymap(
            lambda (x, y): 1 if x > threshold * y else 0,
            zip(s.avg4 * threshold, s.longavg4))

# Lift the beats
sig.beats = signal.lift(beats)
# not sure if this can be called sustain.
# blend gives a decay effect
sig.sustain = signalutil.blend(beats, 0.7)

def graphsProcess(s):
    # clear screen
    surface.fill((0, 0, 0))
    # draw a decaying fft differential and the beats in the full
    # pygame window.
    graphsGraphs([
        barGraph(s.avg12rel / 10),
        boopGraph(s.beats),
        boopGraph(s.sustain)
    ])(surface, (0, 0) + SCREEN_DIMENSIONS)
    # affect the window
    display.update()

def repl():