Working with Hardware: Livid’s Code

The Livid Code is designed to be useable out of the box without programming. The default behavior of the Code’s 32 encoders is to send values in the range of 0 to 127 as MIDI continuous controller (CC) messages. These messages can be easily assigned to software synthesizers to control parameters, providing a physical knob to any virtual instrument that supports controller mapping. The firmware of the Code produces an indication of the value on the LED ring that encircles each encoder.

This behavior, while handy, doesn’t leverage the endless resolution of rotary encoders. The same thing could be accomplished with normal potentiometers without LED rings. If you want to unlock the true potential of the Code, you need to decouple the LED rings from the encoders. This tutorial will show you how to do this in Max, without resorting to JavaScript. Effectively, we’ll get Max’s interface to the Code down to a simple number box, and if you can manipulate a number box in Max, you can do some amazing things with the Code.

1 – initialize the code

The first thing we need to do is set the Code to a known state. The best way to do that is to reset it to its factory default settings. All communication with the Code is accomplished via MIDI messages. The knobs and buttons on the Code send MIDI continuous controller or note messages. Messages that change change the behavior of the Code need to be a bit more flexible, so this is accomplished with system exclusive messages. The admittedly awesome Livid Code wiki details all the messages the Code responds to. Included in this tutorial are examples of these messages, formatted as working Max patches that you can easily adapt to your own use.

Even though the Code uses MIDI to communicate, you don’t need to hook up the MIDI ports on the unit itself. All you need to connect is a single USB cable which both provides power and transports the data. No drivers are required to install.

The first patch example establishes the MIDI port on which the Code communicates. Click on the sysex string to reset the code. The ctlin object instantly responds to the values sent from the Code’s encoders.

2 – decouple the LED rings

Now that the Code is in a known state, let’s decouple the LED rings from the encoders. Currently, the internal firmware of the Code is controlling the LEDs, but we want to do this from Max. This is like turning local control off on a MIDI synthesizer, which decouples the sound engine from the keyboard, so the routing can be controlled with a computer.

Click on the sysex message in patch example 2 to tell the Code you want to change its behavior. Don’t worry, you can always revert to the factory defaults with one click. Once you’ve done that, you’ll notice the LEDs do not respond when you turn an encoder. This is what we want. Values are still sent out from the encoders, but if the LEDs are going to do anything, we’re going to have to explicitly tell them to do so from Max.

3 – delta mode

128 steps of resolution is suitable for a lot of tasks, but with rotary encoders, we have the ability to precisely tailor the value range. We want the encoders to tell us when they are incremented or decremented. Another sysex message puts the Code into ‘delta mode’ Now the Code sends a ’1′ on increment and a ’127′ on decrement. This may seem like a step backwards, but now the encoders are unbounded. In other words, they don’t stop sending values when they reach 0 or 127. We can keep them unbounded or set the bounds ourselves to whatever we want.

We’ve built our own accumulator using the accum object to keep track of the increments and decrements as a running value. This produces an unbounded number that is edited with the first encoder on the Code.

Working with Hardware: Livid’s Code

Dec 13, 2012 at 7:38am

This tutorial is a fantastic resource, and I’ve learned a lot. But I don’t think the sysex used in step 2 is compatible with the latest firmware. It doesn’t seem to disable local control of the LEDs (in Livid’s terminology) or decouple them (in the author’s).

Everything else works great, but the end result is not very usable. (That step is an important one.)

#260566
Dec 14, 2012 at 12:55pm

It seems local control is handled through CC messages now, and no longer sysex.

https://docs.google.com/spreadsheet/ccc?key=0AjLDw8_l-X4rdHZkZzAwSnhFWmVCXzlDVERtWWhoRHc#gid=3

Based on that info, this code sample should decouple all of your LEDs and switch every encoder to relative mode:

– Pasted Max Patch, click to expand. –
#260567
Jun 14, 2013 at 9:51am

Can anyone help me to bring that in an m4l-patch?

#260568

You must be logged in to reply to this topic.