Forums > MaxMSP

APC 40 drawbar problem

Aug 19 2009 | 5:00 pm


I am trying to make a patch where pressing one of the buttons on the 5×8 matrix of the APC40 gives a visual feedback, like horizontal drawbars of an organ. the pressed button should be red, the ones to the left green, the ones on the right off.

My patch is a bit brute force (read: spiderweb…), I suspect I could simplify a few things, but also I think I really need to give it a huge overhaul, because my message order seems to be corrupt so that I get wrong lines lighting up, along with the right one.

I’d appreciate any help, the most valuable would be pointers instead of answers (even though answers would be tempting since they save so much time…Wink, as I really really need to learn more and more…Wink

any help is greatly appreciated!


Aug 19 2009 | 7:43 pm

You could patch together something using [uzi] to send out the numbers between 1 and 8 and then test to see if this number is below, equal to or above the channel number (using [if] or [< ][==][>] or [split] etc) and output your APC colour code: 1, 3 or 0; depending on the result. Shouldn’t take more than 15 max objects. If you’re still stuck let me know and I’ll add some comments to my patch and let you have a look.


Aug 19 2009 | 10:59 pm

thanks a lot, I will try that and post the result.


Aug 20 2009 | 5:59 pm


I gave it a go and got much further this time, much fewer objects and I feel I have a better understanding of what we (the patch and I) are doing. Everything is much more reliable and predictable.

but there are two more problems that I have a hard time tracking down:

when I press a button (of the top three lines, I only use those), channel 8 is output twice (the "print pack" shows that) why is that? I was thinking it’s the original message but that’s not it, since it’s always on channel 8.

the second thing is that the button I press turns red while I press it, but then goes off again, instead of staying red. Again, I fail to see why this happens.

again thanks a lot for any help and pointers!


Aug 20 2009 | 8:14 pm

It looks like the first 8 is sent at the beginning of the message because its the last number stored from the previous message. Your message ordering needs to make the 1-8 count start before outputting the old 8 which is the last number previously stored.

as for your buttons not staying lit, that is the way the APC works. Without hacking into the "handshake" sysex messages to change the way it performs and responds, you are always going to get a note off message when you release the button, and thus the light will turn off. What you need to do is build a quick fix to automatically turn the button back on when it receives a note off message. Shouldnt be too hard to figure out, I got it going in a couple minutes. Sounds like you want to design the fixes yourself so im not gonna post my fixed version of your patch.

let me know if you get stuck or dont understand what im saying. hope this helps.

Aug 21 2009 | 4:20 pm

hey Danny,

thank you very much, this really helped me. I feel like I hacked it a bit by selecting the Velocity 0 of the note off and sending another note after it.

I also switched one number box to a message box and now the double 8 issue is resolved.

Thanks to your and lh’s help, the patch works nicely now, if you have any suggestions still, I’d be very happy to hear them.

Wonderful help in this forum!

again, thanks!


Aug 21 2009 | 7:42 pm

glad you got it figured out. I used int’s to store the button message and sel 0 to trigger them when a note off is received.

I liked your idea with the horizontal drawbars, might have to implement it at some point. Im nearly finished with a huge 2 month project using the APC and Max to control instruments in Ableton Live, and will most likely make a short video showcasing it. I will be sure to let you know when that is done.

Aug 22 2009 | 9:23 am

Here’s the method I came up with, the [jstrigger] is basically replicating your [split] method of triggering the right lighting command. The one thing it doesn’t do is resend the last note after the key-release so you might have to add that in.


— Pasted Max Patch, click to expand. —

Aug 22 2009 | 11:05 am

the jstrigger of course is a good way to make the patch very clean, I must explore that one.

thanks again for your great help to figure things out!


Viewing 9 posts - 1 through 9 (of 9 total)

Forums > MaxMSP