Exemplo n.º 1
0
            time.sleep(1.0/16)

class FadersApp(monome.Monome):
    def __init__(self, address):
        monome.Monome.__init__(self, address)
        self.faders = [Fader(self, i) for i in range(8)]
        for f in self.faders:
            f.start()
    
    def grid_key(self, x, y, s):
        if s:
            self.faders[x].goal = 7 - y

# try to find a monome (you can skip this if you already know the host/port)
print "looking for a monome..."
host, port = monome.find_any_monome()
print "found!"

m = FadersApp((host, port))
m.start()

m.led_all(0)
try:
    while True:
        for i in range(8):
            time.sleep(1.0/20)
except KeyboardInterrupt:
    m.led_all(0)
    m.close()

Exemplo n.º 2
0
            page.update(x, state[x])

        self.aserver.write_buf(self.root_page.render(force=True))

        # Update LED state.
        # State is stored in in column-major order so we have to transpose into
        # row-major order to suit /grid/led/map
        m = ([1 << self.selected_dur, 1 << self.selected_var] + 
                            [sum(((col >> nrow) & 1) << ncol 
                                for ncol, col in enumerate(state))
                            for nrow in range(ROWS - 2)])

        self.led_map(0, 0, m)

aserver = audio.AudioServer(BPM)
aserver.start()

instruments = [audio.load_wav('samples/%d.wav' % p) for p in range(1, 8)]

app = Drilldown(aserver, instruments, monome.find_any_monome())
app.start()

app.led_all(0)
try:
    while True:
        time.sleep(5)
except KeyboardInterrupt:
    app.led_all(0)
    app.close()