Forums > MaxMSP

Counter palindrome mode

May 9, 2011 | 12:03 pm

In mode 2, counter counts up, then down. Is there a way to reverse this so that it counts down and then up?

Thanks


May 9, 2011 | 12:52 pm

Here’s two ways to do it:

– Pasted Max Patch, click to expand. –

May 9, 2011 | 1:09 pm

Thanks. Both methods are far more elegant then the hack I’ve been working on. The difficulty with both is that I want to be able to change the counter value using the set message (eg set 5) and for it to proceed counting down and then up.


May 9, 2011 | 1:34 pm

ah, that proved to be even more elegant than the other solutions:

– Pasted Max Patch, click to expand. –

Everytime you set the maximum, it also sets the current value, so it automatically goes down first (because there is no more further ‘up’ to go).


May 9, 2011 | 1:58 pm

Apologies and thanks for your patience- I’m not explaining this very well. I need the count range to be preserved. I think I’ve got my version working as intended, but it’s a cumbersome piece of code!

– Pasted Max Patch, click to expand. –

May 9, 2011 | 2:19 pm

Ah, now I get it. Hope this does the trick:

– Pasted Max Patch, click to expand. –

(you need to "reset" the updown counting, so that it always goes down, regardless of what direction it was going before you set the number)


May 9, 2011 | 6:15 pm

a "good" palindrome is difficult.

you can either use plain math (% 16), (!- 16), or you can use 2 independent counters.
for me the latter seems for be simpler when you want to switch counting modes
during play, and also for a "reset" function.


May 9, 2011 | 7:03 pm

roll your own palindrome:

– Pasted Max Patch, click to expand. –

May 10, 2011 | 8:23 am

Panaiotis’s autocount object has ‘updown’ and ‘downup’ counting modes, as well as various others. You can find it here: http://www.unm.edu/~panaioti/Max/ObjMenu.htm
Below is an ‘autocountoid’ abstraction that I made when autocount was not UB, and which also has an ‘uppdownn’ mode, ie. repeating the max and min before changing direction, which is useful for arpeggiators etc.
Iirc, the arguments are count mode, initial value, min, max, step and ms between ticks,
cheers
Roger

– Pasted Max Patch, click to expand. –

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