Forums > MaxMSP

Endless Encoder from 128 Step input Midi dial

Aug 31 2009 | 6:52 pm

greetings, so I have been trying to build an endless encoder with my APC40’s knobs. The goal is to be able to morph between pattr presets (interpolate between whole numbers). The way I have done this is when a knob is at its maximum point, it resets itself to a zero value but jumps up a whole number, and vice versa when backwards. What I have done here works well when testing, but when its inside my patch at work, the amount of work max is doing doesnt enable smooth transitions and it often skips a whole number or two. Im guessing because it does not have the step resolution when running all other tasks in my patch, and part of this patch besides just scrolling through numbers is also updating the LED knob display on the APC40. I think what is causing my skipping numbers has to do with trying to update the LED display. When you update the LED display, it moves the value of the knob to that point, so when the max resolution level is low, it will reset the knob to a new number before actually updating the int objects which are holding the new float to move to, therefore sending 2 jump messages before 1 is recieved.
I really feel like there is a much more reliable, non message speed related way to accomplish what im trying to do. My patch is 22mb of pure Max, no MSP, and I have about 160 Pattr families, which is probably one reason why everything is slowing down so much. Any help would be greatly appreciated.

This is what I have done so far. Keep in mind it works when testing, but fails when Max is under heavy CPU load.

— Pasted Max Patch, click to expand. —
Sep 03 2009 | 8:54 am


you might want to set the knob to 360 degrees, it looks better, also you can hold Shift while mousing to get fine-control, a nice feature of . The "clip" message will let it act like a rotary on its own, so you could test passing over or under specific values, which would keep track of the carry count / # of revolutions.

Don’t know about the heavy CPU load creating issues for you. Possibly instead of a for testing the extremes, use , as the numbers might be skipping over the ones in

"if $i1 < 2 || $i1 > 125 then bang else X"

Sep 03 2009 | 7:32 pm

endless to repeating:

[expr (($f1%128)*(($f1%128)!=0))+((128)*(($f1%128)==0)/128)]

for repeating to endless it is enough to chzeck for +1 and -1, it has to be initialised anyway on startup or program load so we
dont know where to start (not necessarily 0.).



Sep 03 2009 | 8:44 pm

to Danny, hi,

Since I am also working a lot with incremental data (from the mouse mainly), I was intrigued by your question. I found an easy way to endlessly increment while filling the decimals between the integers, without relying on message timing. It is very simple, going like:

– differentiate your data with help of the bucket object
– filter out the jumps at the wraparound of the dial/encoder with help of the split object
– divide by 127.
– integrate your values using a plus object in combination with number box (a trick I learnt from jvkr)

Of course I do not know how this method will behave under conditions like in your setup, so let me know about that if possible.


Here’s a demo:

— Pasted Max Patch, click to expand. —
Jul 30 2015 | 11:41 am

all the endless dials work for me when i use it with the mouse.
but i cant get it working with my midi controller (bcf2000).
how can i make the controller dial led switch back to 0 when it hits 127 / switch back to to 127 when it hits 0 ?
(i want to use it in ableton)


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

Forums > MaxMSP