APC Key 25 Button Matrix

Michael's icon

Hi everybody,

I am trying to adapt Mark Egloff's APC Step Sequencer (https://www.ableton.com/de/packs/apc-step-sequencer/) for the APC Key 25, but can't get the button matrix to work. I have to say, I'm not that experienced, as I only built an apc-like device for my old MPK mini 2 years ago, so I need a little help to understand more sophisticated things.

I went with trial and error through all control_surface 0 control ids, but the closest thing I found was the button matrix for the stop clip buttons. The sequencer light runs as expected through the stop buttons, but showing only the first line, as the matrix only has this one line.

But this didn't work with any control id for the clip launch buttons, they always remain in the state as they were before activating the max device.
While trying the control ids, I also found the single buttons in the range from 26-66 (they changed colors as the signal progressed) but no working matrix wrapper control.

Then I went through the ids again with a js outputting the control's info and found 4 button matrix elements in total with ids 67, 79, 80, 81.
81 is the clip stop button matrix and I guess 67 is the clip launch matrix, but it seems it is not properly addressed by the device.

The control receives send_value calls in intervals, like 1 3 5 & 2 1 0, which I guess would address something like button2 row4 stateOn & button3 row2 stateOff.

What can I do? Does anyone have any idea or experience with the APC Key button matrix?

Looking forward for your answers

Michael's icon

I've got it to work, the problem was that the matrix doesn't work when the session component is disabled. Enabling it makes the matrix work.
But this also triggers the clips each time a button is pressed.

I got around this by calling set_clip_launch_buttons and setting them to 0, but in that way they cannot be reactivated, mainly because I don't know how the buttons parameter has to look like.

Do you have any idea how I can use the session component with the buttons not triggering the clips? I'm really trying to avoid translating the single buttons into a matrix on my own, as 40 more observers will be quite a performance impact, I guess...

Michael's icon

I ended up with recompiling the Ableton controller script after adding a method to reset the buttons to their initial values.

Everything works fine now, the step sequencer integrates fluidly with the APC stuff without losing any functionality (switching the selected track enables/disables it).

This little powerful device is just awesome :)

Dennis Brand's icon

Hi Michael,
That's awesome :) Can you share your code/binary?
Regards,
Dennis

sonotron's icon

I'm interested too, could you share it please?

hollyhook's icon

Hi Michael,

had the same problem with an APC mini, which has a nearly identical control surface script as APC ke 25. I used your idea, disabling the clip launching with set_clip_launch_buttons to 0, thanks for that. I figured out how to restore the lauch buttons, using javascript:

    var buttons = api_buttonmatrix.call("iterbuttons");
    // returns "id" "-45" "1" "0", ...
    for (var x = 0; x < 8; x++) {
        for (var y = 0; y < 8; y ++) {
            var cs = x + "_Clip_Slot_" + y;
            var lbid = buttons[(x + y*8)*4 + 1];
            var slot = new LiveAPI(path_of(cs));
            slot.call("set_launch_button", "id " + lbid);
        }
}
it basically gets the path to each clip slot, and sets its lauch button to the button ids which are hold in the Button_Matrix. Unfortunately that code gives some warnings on the max console, so it is risky, and i don't know how to get rid of them.

Michael's icon

The essential addition I made, happened in the SessionComponent. It now saves the initial contents of the buttons variable in a class property, so it can be reset by the added method reset_clip_launch_buttons().

Since I got some PMs from people who where interested in the step sequencer I'll post it here. Of course, as this is by 97% the original developer's work, all the credits belong to him. Those 3% are quite a lot changes (which I don't really remember, since this is more than a year ago) but I did not manage to port all functions from the original. It's in a quite usable state anyway and I already had countless hours of fun with it.

To get the control surface script into Ableton, extract APC_Key_25.zip, goto Applications, right-click Ableton Live.app, select 'Show Package Contents', navigate to Contents/App-Resources/MIDI Remote Scripts and drag the extracted folder there. Afterwards you can select it in the Live Preferences.
The Max device can be used like any other.

Maybe someone else can get some more functions to work (I would have loved to have that accent, but I failed)

Hope this is of any use for someone :)

APC25_StepSeq.zip
zip
David Litke's icon

Hi,
I've been trying to figure out how to control the leds on my APC Key 25 from Max 7 (not Max for Live), and it seemed like this thread would be a good one to jump on - the posters above seem to have solved this issue, but I'm missing some basic information in order to figure out how to do it.

What I think I'm looking for is some javascript code that I can put in a js object so that it accepts messages indicating a button address and color.
Hollyhook's code above looked promising, but I don't know what else needs to go around it to make it talk to the APC.

Does anyone have a maxpatch or js code they can send my way?

Thanks,
David

hollyhook's icon

that code I posted uses the Live API, meaning it doesn't work in standalone Max. So it would not help you, sry.

David Litke's icon

okay, thanks anyways!

dpitre's icon

Seeing if anyone on here can offer any help/advice/guidance. I just bought a APC Key 25 and I'm having a similar issue.

I need the APC Key 25's buttons (at very least the ones in the grid) on the controller to give me feedback with their LEDs. So "out of the box" (and with nothing selected in the Control Surface menu) I can map all of the buttons and knobs to various controls in LIVE, some of them being on M4L devices, via its MIDI Learn function. But, when I use buttons to toggle on an element on a device (say a live.toggle), while the corresponding APC Key 25 button lights up when the LIVE element is toggled on, when I toggle it off the light on the APC Key 25 button stays lite up ... given me no "feedback" as to what is on and what is off.

It would also be great to be able to chance what MIDI value each button sends. But at this point I won't be picky.

Michael - maybe the step seq script would take care of this? If not, maybe a slight mod I could do?

Thanks much

Mikulas's icon

I'm thinking about buying APC Key 25, bump for interest.

Tomek  Wladio's icon

Hello. Step sequencer works fine but when I save session and then open it it doesn't work. It is inactive .What can be wrong with that.
Thank you for your help.

Rodrigo Prat's icon

Hello I have an apc 25 and I downloaded apc25_step_seg.zip, I attach 2 print screens showing what i do. I cant get it to work. Can you help me? maybe there is a youtube tutorial for making it work? In the second print screen you can see that there is not only one device for select in te list. Thanks in advance.