launchpad_controller.js

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

Output

  • 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.

Arguments

  • 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.

Messages

  • 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

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

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.

Examples

  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

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.

Ronny Turiaf – Basics

Ronny Turiaf's Editor, Mix, and Sub-Editor windows.  Creating a reasonably functional user-interface for the program was a critical challenge.  The program is written in Max 4.5.7.  Max 5 was released after I had finished 98% of the program and came with many UI enhancements which would've made many jobs easier.  So it goes. :-).

Ronny Turiaf's Editor, Mix, and Sub-Editor windows. Creating a reasonably functional user-interface for the program was a critical challenge. The program is written in Max 4.6.2. Max 5 was released after I had finished 98% of the program and came with many UI enhancements which would've made many jobs easier. So it goes. :-).

Disclaimer: Ronny Turiaf, the former Laker who now plays for the Golden State Warriors has nothing to do with this program! I just borrowed his name because the first sounds I made with the patch reminded me of the sound of his name…

Purpose

Ronny Turiaf was built to enable dynamic, animated performances out of written MIDI sequences. It can best be thought of as storing a bank of customizable articulations which create complex transformations over a variable length of time.

How it works

Ronny Turiaf takes an input MIDI sequence of pitch/note values with two additional values (for Articulation and Duration) to tell Ronny Turiaf how to calculate its modulation envelopes. It will take these values and turn them into a note/velocity pair plus a stream of MIDI CC messages for up to 6 parameters to add dynamism to the performance. You can route this information to any software or hardware which responds to MIDI information.

Input MIDI

Using Ronny Turiaf requires just a few additional bits of information on top of the most basic MIDI sequence (i.e., notes represented as Pitch and Velocity combinations). These are:

  • Articulation/Type: Specifies the articulation index to be used for this note or note group.
  • Duration: Specifies the length of the note.
  • Sustain Pedal: (Optional) This can be used to include multiple notes under the arc of a single articulation.
Input MIDI information is relative sparse compared to the data which comes out.

to Ronny Turiaf – Input MIDI information is relative sparse compared to the data which comes out.

The input information becomes stream of MIDI CC data to make a detailed, dynamic performance.

From Ronny Turiaf – The input information is returned as a stream of MIDI CC data to make a detailed, dynamic performance.

Articulation Parameters

Articulations create new/additional performance information for the following parameters:

  • (A,B…E) = MIDI CC x 5: Any 5 MIDI Control Change numbers may be used. Within the articulation bank these are represented by A-E. The CC number for a specific output is the assign at the point of output.
  • pWhl: This represents the MIDI Pitch Bend controller.
  • Ch (Channel: You can assign the output elements to a different MIDI Channel than the input information if desired. This is useful because you may send different articulations to different targets entirely.
  • Pitch: You can override any input pitch by specifying a specific pitch for an articulation. This is most useful for creating percussive sounds with a consistent pitch base.
  • Vel: You can override any input velocity by specifying a fixed velocity base for the articulation.
  • Dur: Duration of the articulation affects how long a note is sustained and how long the modulation envelopes take to run their course.

The basic premise for using any of the above parameters is the same: specify a base value for the value and then modulate using the modulation envelopes and/or input parameters like pitch, velocity or either of two randomizers. Their effects will appear idiomatic to anyone familiar with synthesizer modulation settings.

The Modulation Envelopes

In addition to storing initial values for an articulation, four free break-point modulation evelopes can be used.  The duration may be on an absolute scale, tied to tempo, or a percentage of note length.

In addition to storing initial values for an articulation, four free break-point modulation evelopes can be used. The duration may be on an absolute scale, tied to tempo, or a percentage of note length.

The primary difference between the performances achievable using Ronny Turiaf and using a synthesizer’s built-in modulation capabilities lies in the envelopes. Ronny Turiaf can calculate the run of its envelopes based on the duration of the note. By linking the envelope directly to the length of the note the amount of change over time can be scaled in a more musical fasion.

For instance, if a particular articulation swells from a quiet dark sound to a bright loud one, the effect can be stretched over a fraction of a beat or several bars depending on the length of the note. The closest most synths can come is by using a MIDI control to modulate all parts of the AHDSR envelope equally but this requires knowing the exact curve of the modulation range for both the absolute and beat-sync timing options for the envelope (assuming you are allowed to set these).

One other major advantage of using an external system to do this is that you can modulate elements outside of synthesizers with these envelopes such as external effects devices or plug-ins.

More to come…

MaxMSP Intro

MaxMSP is a visual programming language originally created at IRCAM, an avant-garde music institution located in Paris, and now supported by SF-based Cycling ’74.

I found out about MaxMSP after getting interested in music by the electronica duo Autechre – I’d never been very taken by any ‘classical’ experimental music using the combination of computers and acoustic instruments, but I thought the beats and textures Autechre created were very interesting and I wanted to be able to make them myself.

After spending a year or so learning the ropes of the MIDI side of the program, I embarked on making a massive utility for sequencing complex MIDI performance information. Having a lot of experience with various acoustical instruments and in orchestras, I felt individual sounds made by synthesizers frequently felt sterile and I could make instruments feel more visceral by supplying a large amount of extra performance data. For instance, a violinist can change the sound of their instrument with bow speed, bow pressure, where the bow runs over a string, plucking the string (to name just a few)… I wanted a patch which could simulate this variety of sounds and feelings from a synthesizer. All the cooler if it could be done in such a way that would eventually allow for a computer to generate sequences in real-time (like Autechre’s generative beats) that actually cultivated feeling rather than just structure.

The current working version is called Ronny Turiaf and a portion of it’s inner architecture is shown below. This version takes input of a MIDI sequence (from a sequencer such as Logic) and returns the enhanced performance. It does not yet have its own generative sequencing capabilities.

The surface of Ronny Turiaf's 'engine', this is where modulation envelopes and their effects are calculated.

The surface of Ronny Turiaf's 'engine', this is where modulation envelopes and their effects are calculated.