Browsed by
Category: launchpad controller

posts specific to launchpad controller



launchpad_controller.js is the brains which connect your Max patch to your Launchpad. Use this as an argument to a max js object.


  • Left outlet (Outlet [0]): list: MIDI Note messages (pitch / velocity) to be sent to Launchpad.
  • Outlet [1]: list: MIDI CC messages ( CC # / value) to be send to Launchpad.
  • Outlet [2]: list: button key:state pairs when the state of a button changes.
  • Right outlet (Outlet [4]): symbol: The name of the Max dictionary object for reference elsewhere in the Max patch.


  • name: optional: The name of an existing Max dictionary of button type/state saved in .JSON format which will be loaded in place of the default dictionary.


  • Inlet [0]: list (int int): MIDI Note messages (pitch / velocity) from Launchpad will change state and cause output out of outlets 0 and 2.
  • Inlet [1]: list (int int): MIDI CC messages (CC # / value) from Launchpad will change state and cause output out of outlets 1 and 2.
  • Inlet [2]: list ( symbol int ): Where “symbol” is a symbol specifying the name of a button, such as “top_0”, “b_0”, “side_7”, the state of that button will change to the int. If int is out of range for the allowed states for a button then state will be changed to the closest valid state. This causes output from outlet 2 and either outlet 0 or 1 depending on which type of button it is.If only the symbol is provided, it will act like a button press of that button, causing state to increment (if appropriate) before outputting value.

Other messages (for Inlet [0]):

  • zeroAllStates : set all states to zero and cause output.
  • turnOffAllLights : without changing state, this will send value 0 out for all MIDI note and CC causing the lights to turn off on Launchpad.
  • turnOnAllLights : sends out the current light color (velocity) values for MIDI note and CC buttons causing the lights to turn on on Launchpad.
  • load : Load a previously saved .json dictionary.
  • saveData : save the current dictionary/state to a file named ‘filename’.
  • getDictionaryName : causes output of the current dictonary name (likely of the form u123456789) out the right outlet.
  • newDict : creates a new dictionary from the defaults.

demonstrating the basic connections to hook launchpad_controller.js into your patch



VirtualLaunchpad is a patch which looks and behaves like the “empty shell” of a Launchpad.  It was originally made so that it would be easy to figure out how to hook the Launchpad into my Max patch when I didn’t have the Launchpad with me.

VirtualLaunchpad being used for decorative text display… because that is useful.
VirtualLaunchpad wants to know what’s up.

Using VirtualLaunchpad

To use VirtualLaunchpad just open VirtualLaunchpad.maxpat and re-assign the MIDI input and outputs. If your patch can send and receive the correct data when your ports are assigned to the ones VirtualLaunchpad is using, then when you plugin your hardware and re-assign those ports to the “Launchpad” ports, it will just work.

Mira and VirtualLaunchpad

The patch recently became more useful when Mira was released because now you can use an iPad to interact it.  Though there is the question of “why would I do that when I can just put my Max patch directly on the iPad via Mira?”.  So in reality, while the Mira benefit is neat, since it still doesn’t provide a physical feedback and you can’t take your eyes of it when using it it is not a huge win.

How Launchpad works

How Launchpad works

The Launchpad sends MIDI messages when buttons are pushed, and the buttons light up different colors when MIDI messages are sent to it. With the exception of the top row of buttons, each button corresponds to a MIDI note’s pitch value. Color is determined by the second byte of MIDI data (which for a MIDI note is the velocity).

The Launchpad proxy displaying a question mark and an exclamation point
How does it work?!

MIDI messages from Launchpad

  1. Button Pressed: sends pitch with velocity 127
  2. Button Released: sends pitch with velocity 0
  3. Top Button Pressed: sends a MIDI CC with value 127
  4. Top Button Released: sends a MIDI CC with value 0

MIDI messages to Launchpad

  1. MIDI Note: lights up the corresponding button (if it exists) a particular color based on the note velocity.
  2. MIDI CC: lights up the corresponding top button (if it exists) a particular color based on the control change value.

MIDI Button mappings

The 64 square buttons in the main grid are assigned pitch values starting from 0, where each row has the first 8 contiguous values in modulus of 16. So the first row sends MIDI notes [ 0, 1, 2, 3, 4, 5, 6, 7 ] and the second row sends MIDI notes [ 16, 17, 18, 19, 20, 21, 22, 23 ], the third row starts on [ 24, 25… 31 ].

The circular buttons to the right of the main grid are the “next” button for each row. So for the first row, the circular button to the right is MIDI note 8, and for the second row it is MIDI note 24.

The top circular buttons, from left to right, correspond to MIDI CC 104 to 111

Velocity : Color mappings

The color mappings are less intuitive or structured than the button mappings. The most reasonable approach for me was to assemble a (subjective) table of the usable colors.


  1. Sending MIDI note 119 with velocity 48 lights up the bottom right button bright green.
  2. Sending MIDI note 119 with velocity 0 turns off the light of the bottom right button.
  3. Sending MIDI CC 107 with value 13 lights up the 4th of the top circular buttons a dim red.
  4. Sending MIDI note 12 with velocity 127 doesn’t do anything, because there is no corresponding button on the Launchpad.
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.