Forums > MaxMSP

UpDown Counter needs to count first and last number twice…?

May 3, 2010 | 4:17 pm

greetings.

iam using a counter to drive a step sequencer.

i want to add "palindrome" (play forward,play backward and so on) playback to it.

the problem is to keep it in sync.

i made a (counter 1 16) and set it to mode3 (count up then down)
the problem is.. it counts … 14 15 16 15…
but to stay in sync i need it to count … 14 15 16 16 15 14…
so the first and the last number have to be counted twice.

is this possible with just one counter?


May 3, 2010 | 5:05 pm

It’s not pretty:

– Pasted Max Patch, click to expand. –

May 4, 2010 | 3:10 am

oh yeah, when i made my first counter with both a palindrome and
backwards/fprward mode i almost kicked the computer out of the window.

that was somewhen between the fifth and sixth attempt.

making it just run somehow is easy, but to make the "reset" work, change
the direction by user input, or changing the mode it is quite complicated
with only one counter object.
 


May 4, 2010 | 8:40 pm

hey guys.

i thank you very much.
i got really mad while i was trying to figure it out myself.


May 5, 2010 | 7:46 am

Two more goofy solutions:

– Pasted Max Patch, click to expand. –

May 24, 2010 | 7:33 pm

Hey all, brilliant. I can’t believe how much time I spent trying to make counter do what it seems like it should just DO out of the box. Thanks!

Look, I didn’t even have to post a question.


May 25, 2010 | 8:22 am

Wow. Here’s my new teaching example for the adage "There’s more than one way to do anything in Max."

While palindromes for your drum machine are things that you would definitely want, this is a *counter* object, and you don’t duplicate upper or lower numbers when increment or decrement counters as the more general case, I think.

As long as you’re at it, why not add inlets and outlets as required and save the one of these you really love in your patches folder with a nice name (palindrum?)? That way you can just type "palindrum" into an object box and never worry about it again!


May 25, 2010 | 9:34 am

Agreed, GT, I’m amazed at how many ways there are to do this. Here’s a non-drum-machine application for this functionality. I’m using counter to fade two panels’ alpha channels, for a game-based patch. (The lit-up panel shows whose turn it is). With counter, the panels would fade in one direction (let’s say it’s fading out) and then "snap" back on at the end. So the final state always ended up being opposite of what I wanted. Perhaps there’s an easier way around this, but:

– Pasted Max Patch, click to expand. –

May 25, 2010 | 9:37 am

P.S. Vanille’s way is awesome though. I aspire to that level of elegance. (As you can see, I have a lot of perspiring to do)


May 26, 2010 | 2:05 pm

And here’s another – not mine, I hastened to add, but I’ve been using it for so long, I’ve forgotten where it came from. Essential for arpeggiators too…

– Pasted Max Patch, click to expand. –

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