def __init__(self): launchPads = launchpad.findLaunchpads() print launchPads self.lp = launchpad.launchpad(*launchPads[-1]) self.lp.reset() self.client = None self.running = True
def __init__(self, xcount, ycount, simSize=4, xskip=2, yskip=1): self.xcount = xcount self.ycount = ycount self.xskip = xskip self.yskip = yskip # Set up launchpads launchPads = launchpad.findLaunchpads() if launchPads: if len(launchPads) != xcount * ycount: print "Found %s launchpads, expecting %s" % (len(launchPads), xcount * ycount) for l in launchPads: self.launchPadObjs.append(launchpad.launchpad(*l)) self.launchPadObjs[-1].reset() else: # Use simulator import launchpadSim self.launchPadObjs = launchpadSim.setupMany(xcount, ycount, simSize, xskip, yskip)
def __init__(self, xcount, ycount, simSize=4, xskip=2, yskip=1): self.xcount = xcount self.ycount = ycount self.xskip = xskip self.yskip = yskip # Set up launchpads launchPads = launchpad.findLaunchpads() if launchPads: if len(launchPads) != xcount * ycount: print "Found %s launchpads, expecting %s" % (len(launchPads), xcount * ycount) for l in launchPads: self.launchPadObjs.append(launchpad.launchpad(*l)) self.launchPadObjs[-1].reset() else: # Use simulator import launchpadSim self.launchPadObjs = launchpadSim.setupMany( xcount, ycount, simSize, xskip, yskip)
if e[2]: if self.mode == 0: self.lp.light(e[0], e[1], 3, 3) elif self.mode == 1: self.lp.light(e[0], e[1], 3, 0) for c in Test.FENCE: self.lp.light(e[0] + c[0], e[1] + c[1], 3, 3) elif self.mode == 2: self.lp.ledTest(3) self.lp.light(e[0], e[1], 0, 0) else: if self.mode == 0: self.lp.light(e[0], e[1], 0, 0) elif self.mode == 1: self.lp.light(e[0], e[1], 0, 0) for c in Test.FENCE: self.lp.light(e[0] + c[0], e[1] + c[1], 0, 0) elif self.mode == 2: self.lp.reset() time.sleep(0.01) if __name__ == "__main__": launchPads = launchpad.findLaunchpads() l = launchpad.launchpad(*launchPads[-1]) l.reset() t = Test(l, 1) t.run()
import polydelay, launchpad, softstep receive_port = ( '127.0.0.1', 9600 ) send_port = ( '127.0.0.1', 57120 ) # Sending send = OSC.OSCClient() send.connect(send_port) # (host,port) # Receiving receive = OSC.OSCServer(receive_port) receive.addDefaultHandlers() # Launchpad Object launch = launchpad.launchpad(send_port, receive_port) # Softstep Object soft = softstep.softstep(send_port, receive_port) # Polydelay object poly = polydelay.polydelay(send_port, receive_port) ### --------------------------- ### # p_methods = { # 'input_volume':p.set_input_volume, # 'output_volume':p.set_output_volume,
#!/usr/bin/env python2.7 import launchpad import time import random if __name__=="__main__": ls = launchpad.findLaunchpads() l = ls[0] l = launchpad.launchpad(*l) l.setDrumRackMode() l.reset() #l.ledTest(1) time.sleep(1) color = (3, 0) colors = ((3, 0), (1, 0), (0, 3), (0, 1), (3, 3), (1, 1), (0, 0), (0, 0)) for i, c in enumerate(colors): l.light(i, 8, c[0], c[1]) def updcol(): l.light(7, 8, color[0], color[1]) updcol() while 1: event = l.poll() if event: x, y, state = event if state: if y == 8: if x < 7:
#!/usr/bin/env python2.7 import launchpad import time import random if __name__ == "__main__": launchPads = launchpad.findLaunchpads() launchPadObjs = [] for l in launchPads: launchPadObjs.append(launchpad.launchpad(*l)) launchPadObjs[-1].setDrumRackMode() #l.reset() #l.ledTest(1) while 1: x = random.randint(0, 8) y = random.randint(0, 8) r = int((x + time.time()) * 3 / 8) % 4 g = int((y + time.time()) * 3 / 8) % 4 launchPadObjs[0].light(x, y, r, g) launchPadObjs[1].light(x, 8 - y, r, g) launchPadObjs[2].light(8 - x, y, r, g) launchPadObjs[3].light(8 - x, 8 - y, r, g) time.sleep(0.001)
#!/usr/bin/env python2.7 import launchpad import time import random if __name__ == "__main__": launchPads = launchpad.findLaunchpads() launchPadObjs = [] for l in launchPads: launchPadObjs.append(launchpad.launchpad(*l)) launchPadObjs[-1].setDrumRackMode() # l.reset() # l.ledTest(1) while 1: x = random.randint(0, 8) y = random.randint(0, 8) r = int((x + time.time()) * 3 / 8) % 4 g = int((y + time.time()) * 3 / 8) % 4 launchPadObjs[0].light(x, y, r, g) launchPadObjs[1].light(x, 8 - y, r, g) launchPadObjs[2].light(8 - x, y, r, g) launchPadObjs[3].light(8 - x, 8 - y, r, g) time.sleep(0.001)
if available_ports: midiout.open_port(0) midiout2.open_port(0) midiout3.open_port(0) midi_masha.open_port(0) else: midiout.open_virtual_port("My virtual output") #init launchpad ls = launchpad.findLaunchpads() print ls try: print "trying to launchpad" l = ls[0] l = launchpad.launchpad(*l) l.setDrumRackMode() l.reset() except IndexError: print "launchpad not found" Soop = Sl() Pad = Lpad_lights() Pad.monochrome(0, 0, 3) #fg Pad.monochrome(3, 1, 2) sleep(.5) #display / cycle through modes, end with bg (default background)