Remember LED On/Off states for 2 banks of clips

gabriels

2012-09-18 02:42:22

I built a midi controller which has a 16x7 matrix of switches for launching clips in Ableton Live. The clips are in 16 tracks, each with 7 clips. Each switch has an associated LED which shows if that clip is playing (LED on if clip is playing...off if clip isn't playing). The state of the LEDS is controlled by note on/off messages from Live.

For simplicity, I'll illustrate with just three tracks.
Bank 1
Track1__Track2_____etc____Track16
Clip1......Clip15........ etc ......Clip99
Clip2......Clip16........ etc ......Clip100
Clip2......Clip17........ etc ......Clip101
Clip4......Clip18........ etc ......Clip102
Clip5......Clip19........ etc ......Clip103
Clip6......Clip20........ etc ......Clip104
Clip7......Clip21........ etc ......Clip105


Well, actually, there are two "banks" of clips.
A toggle switch determines which bank of clips will be launched. So...there is a bank 2 as follows.
Bank 2
Track1__Track2_____etc_____Track16
Clip8......Clip22........ etc ......Clip106
Clip9......Clip23........ etc ......Clip107
Clip10.....Clip24........ etc ......Clip108
Clip11.....Clip25........ etc ......Clip109
Clip12.....Clip26........ etc ......Clip110
Clip13.....Clip27........ etc ......Clip111
Clip14.....Clip28........ etc ......Clip112

The problem is that, when I switch banks, the LEDs represent the status of clips (playing or not playing) for the bank i just "left behind". I would like to store the current states of all LEDs in each bank so that when I switch banks, the LEDS show which clips are playing in the bank I just switched to.

I can imagine doing this by storing a set of variables, for each bank representing which LED is on in each track of the current bank. Then I could query those variables when I switch banks, and turn on the LEDS that represent the clips that are playing.
But this seems tedious and plodding. Is there a clever way to do this?
Thanks,
Gabriel

gabriels

2012-09-18 21:34:52

In fact, looking at the messages Live sends back these messages to the controller, here's what happens when I launch a clip:
Live sends:
- A continuous controller message with value 126 and the value 127 in quick succession for the clip that's just been launched. (Turns on LED)
- A cc message with value 0 for the clip that was previously playing in that track (if there was a clip playing).(Turns of that LED)
- A track launch message for that track - value 127.
I can understand all these. But what I don't understand is that Live also sends a cc message to turn off all other clips in the same row as the one I've just launched. The messages are only sent for tracks that are not currently playing a clip. If a clip is playing, no LED off message is sent.
Can someone explain this?
Thanks,
Gabriel

DvlsAdvct

2012-09-20 17:54:48

Hi gabriels

So Ableton is a strange beast when it comes to MIDI. I'm working on a big project for it so I feel your pain.

Ableton is effectively sending MIDI that "reminds" whatever controller you're using that the signal is off. It's sort of like a global update. "Hey look, this clip state changed, so we're going to update ALL clip states" and since clip states are tied to track states, that's what happens.

To store your LED values, what I'd do is have a preset dedicated to receiving MIDI from Ableton. Each command you want to store should have a translator with that signal setting the appropriate global variable. The outgoing message would be a timer with 0ms delay. To reduce the times this timer is getting triggered, you would need to have rules set that prevent triggering the timer when it isn't needed. This would look something like

Code: Select all

if pp=127 then Goto "On"
if pp==0 then Goto "off"
Label "On"
if g0==1 then exit rules, skip outgoing action
g0=1
Exit rules, execute outgoing action
Label "Off"
if g0==0 then exit rules, skip outgoing action
g0=0
Exit rules, execute outgoing action
You would then have a Preset dedicated to sending LED outputs to your controller. The incoming message would be that timer, and the outgoing message would be based on the value of the global variable. So now we are storing your LED state as a global variable.

NOW, since you are switching banks, I would tie that to preset switches as well, so when the bank switch signal is sent, MIDI Translator opens the corresponding Preset (bank 2) and when that happens you have a bunch of translators that set the LEDs based on the global variable. You could do that a number of ways by either retriggering the timers that are needed, or just setting the LEDs based on the variable values. It's tedious and as of now there is no clean way to do this. But once it's done you never really have to change it again

J

gabriels

2012-09-20 19:19:33

Dear Advocate,
I'm just sorry I didn't adopt your username before you did ;-)
As for your explanation, thanks very much. Your "design" makes sense. I'll adopt it and post the results when I'm done.
Keep advocating,
Gabriel

DvlsAdvct

2012-09-20 21:01:48

Yeah I've used this moniker for YEARS now. Yay internet.

Regardless, let me know if there are any snags along the ways. :)