Counter palindrome mode

    May 09 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?

    • May 09 2011 | 12:52 pm
      Here's two ways to do it:
    • May 09 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 09 2011 | 1:34 pm
      ah, that proved to be even more elegant than the other solutions:
      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 09 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!
    • May 09 2011 | 2:19 pm
      Ah, now I get it. Hope this does the trick:
      (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 09 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 09 2011 | 7:03 pm
      roll your own palindrome:
    • 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:
      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,