Working with Hardware: Livid’s Code

Welcome to the first installment of a new series: “Working With Hardware”. For our first go-around, we are going to be working with a relatively new hardware controller – the Livid Instruments’ Code – and will create some useful software for this system from scratch. I’m going to start by making a basic sequencer, and then we will follow up with a few more advanced tutorials, giving you the opportunity to follow several developers as they create useful and interesting software for a specific device.

After taking a quick look at the Code, I realized that all the pieces were there for an interesting sequencing device. We have multiple rows of knobs, row and column buttons, and a nice big button that would be perfect for a start/stop button. Something you might not be able to tell from product pictures, though, is a key feature: each of the rotary encoders is also a push-button switch, something I could use for individual step gating as well. That was all that I needed to know to get started.

The Livid website has a pointer to a Wiki page that had a lot of great information. The most useful part of the documentation was the following diagram:

Since the Livid Code is a MIDI device, this one diagram held all the keys to the kingdom for me. Using this documentation and a piece of scratch paper, I started putting together my plans for a super 32-step sequencing device, where the entire user interface would be done at the controller.

Creating the Clocking Subsystem

The first thing that I wanted to tackle was the clocking system – the core of any step sequencer, and a challenge for a hardware-centric UI. While each step has a small white LED available, I wanted to leave those for individual step gating, so I had to find something else.

With a set of row and column buttons, I realized that I could just show the current step by showing the current row and column; visually, it would be easy to track the step by triangulating the two points. Since I was going to make this a full-on 32-step sequencer, it meant that I needed to get something that would count from 1 to 32 (or better yet, 0 to 31), then map that to the buttons.
I started with the basis for any good timing system: the transport object. I decided to stick with 16th notes, so I just built a simple way to start and stop the transport, and I used a few simple math objects to get the output down to a 0-31 range. Once I had that range, I further split the numbers so that I had a row (0-3) and column (0-7) number that could map to the Code’s buttons.

Now that I had a tracking system, I needed to tie it to the physical device. Working with MIDI for this is a breeze, so I just started with a basic midiin and midiout scheme (with midiparse and midiformat, respectively) and a few objects to let me select a MIDI device. Creating the start/stop button was first: since buttons map to MIDI notes, and the Big Button is mapped to MIDI Note 37, I just took the incoming note stream, checked for 37, and toggled the transport on and off on each push. You’ll also note that I reset the transport time to 0 (the beginning) whenever I stop.

Next up is the display of the current row and column. We are going to use the numbers that we got from our clocking system and generate notes from them: a note sent to a particular button will turn on the built-in LED, while a note-off will turn it off. Rather than do a bunch of calculations to determine how long the LED should stay on, we’ll just use the makenote object’s ability to slave to the transport, and have it control its own duration.

We take the column number and add 38 to it – this will work with the buttons from left to right. Since we are clocking the system at 16th notes, having the button’s LED strobe at 32nd notes seems appropriate. So that’s what we do – and we now have the columns displaying the current step.

Working with Hardware: Livid’s Code

Jan 4, 2012 at 2:14pm

Love the Code (I kill on the OHM64) and love Max (in the studio). I wrote a web-app that writes Python for control surface scripts (Ableton) available here : – we are adding new scripts asap as they are written. Tight code FTW!

Jan 4, 2012 at 7:34pm

Will this work in MAX for Live? Not sure how to load up the patch. New to this game.

Jan 7, 2012 at 3:03am

Thx. Very useful tutorial, even to other hardware devices.

Jan 12, 2012 at 7:23am

Hi All,
Great tute,
As I don’t have an actual CODE, I decided to make up a Lemur version of Livid’s CODE hardware MIDI controller . . .
Version 0.9 beta uploaded to Liine Library –
Seems to work with your CodeSequencer, which was the point of the exercise, as well as a bit of fun . . .
It should mimic the hardware’s MIDI messages – switches hidden under leds rather than knob/push-switches on hardware . . .
Proof of concept only – may not be coded the best, will need to review it at some point. Will probably ‘pimp it out’ later . .


Jan 12, 2012 at 8:19am

Oh, this is lovely..ive been working at a sequencer of my own for my code..but i love this soo much more..i love the idea of the lights on the bottom being the running lights with the left lights showing which row so you can use the leds under the encoders to indicate i just have to figure out how to get some layers or something..for velocity..and note lenght and so on..would be lovely..but im pretty worthless at sequencer uses the live.step object since it already has some of this..but still its…really messy..this

Another thought on layers would be that different layers could also have different encoder push say glide on the pushbutton on the lenght layer or something..

Also have a question about that number 4. “Click on the smaller buttons to jump to a specific step.”

whats up with that function..cant find anything that does that in the patch..?…is it something for later?..

Jan 13, 2012 at 11:12am

Thanks Darwin, it is thanks to people like you that we still have time to compose music.

Feb 27, 2012 at 3:09am

Marc your web app tip is very useful.. Thx
i searched for a Programmer they can add funtion to a remote script of my Livid Code controller…
Please I need a tip to find people they can created a script for me…! Money logo no problem !


wfg S.R.

Apr 4, 2012 at 11:59am

will this patch work with Max 5? (my guess in “nada”) – thanks

Nov 29, 2012 at 7:31pm

I did some updates to this and made standalones for Max and Windows. More info here


You must be logged in to reply to this topic.