What Launchpad Controller Does

What Launchpad Controller Does

Launchpad, like many external MIDI devices, is just an empty shell with buttons and lights. What it’s missing is a brain, or state. By making an interface which tracks state we can correlate colors with state, and provide useful visual feedback as you and your Max patch interact with the Launchpad.

How it works

In Launchpad Controller, each button on the Launchpad correlates to a JSON dictionary like this:

"b_0" : {
"state" : 1,
"colors" : [ 13, 48, 18, 0 ],
"action" : "increment",
"midi_note" : 0
}

The “b_0” key is the top-left square button on the launch pad, and correlates with MIDI note 0.

The system is fairly simple: a button has as many possible states as it has colors in the “colors” array. When the “action” key’s value is “increment”, each button press increases the “state” value by one, looping back to 0 after the max has been reached (in this case 3).

VirtualLaunchpad with button states lit up to display the word "hi"
A grid of 3-state buttons.

In the case of the above dictionary pressing the corresponding button on the Launchpad changes the state from 1 to 2 and outputs a list “0 18” out the left outlet of the js object. Assuming this is passed out to the Launchpad via noteout object the button will change color to a dim orange. Pressing it again will send “0 0”, which will turn off the light. As you might’ve guessed, the numbers in the “colors” array are the velocity values of the notes and correspond to different colors.

Hooking into your Max patch

Anytime state changes for a button, in addition to updating the lights on the Launchpad the changed state is also reported out the 3rd outlet, keyed by the dictionary name. So when “0 0” went out the leftmost outlet, “b_0 3” would have gone out the 3rd outlet. Use these keys/values to decide what to control in your Max patch.

Comments are closed.