Python library to interact with your midi devices
This library is built for Novation launchpads and only tested with Launchpad Pro
Suitability for other Launchpads is not quaranteed
Preview videoThe library is wrapped around pygame library in order to get access to midi devices
import lpad
launchpad = lpad.Init("live")
Make sure you are using the right mode. Live mode uses a different channel and therefore needs to be told as an argument.
Listening events happens using the feature decorator
onData
Is called on every data object received. Use this to implement your own events
@launchpad.feature
def ondata(data):
print(data)
@launchpad.feature
def keypress(note):
print(note)
@launchpad.feature
def keyup(note):
print(note)
@launchpad.feature
def modechanged():
print("ready")
modeChanged and modeReady are only called if the modes operate in the same channel
Before you can receive any events you must start listening incoming data
This is done by calling the poll method
launchpad.poll()
Make sure you call the poll method after you have defined all your events since it runs in the same thread
When you are done using the midi ports make sure you close them using the close method
launchpad.close()
on, off, and clear methods are part of light controlling
launchpad.on(key=81, color=51)
launchpad.off(key=81)
on method takes an extra argument which is the color of the button. The color integers can be found below
launchpad.clear()
clear is used to turn off all lights
Launchpad pro has 5 different modes. live, note, drum, fader and programmer
Make sure you import the right mode in the constructor, otherwise it wont work properly
Use the onData event to implement your own events for different modes
Data received depends on the used mode. Keys are also different in each mode