Counter reset to new number and start "0 1 2 3 4" count

    Jun 16 2011 | 7:21 pm
    Hi everyone,
    I've tried and tried, search the help, tutes and forums, but I'm really boiling up on the counter-object these hours...
    I need a behaviour like this: the counter gets bangs and counts from 0 and upwards. When it reaches max, its resets and gets a new max. E.g.:
    0 1 2 (MAX! New max: 8)
    0 1 2 3 4 5 6 7 (MAX! New max: 3)
    0 1 2 (MAX! New max: 8)
    I've tried lots of things - see my suggestions below. Actually I don't quite understand the counter behaviour in them - so if anyone could explain the double 0 and the -1 in them, I would be more than extremely thankful!
    A quick solution to my problem would even extend my thankfulness :)

    • Jun 16 2011 | 7:53 pm
      Your patch doesn't make all that much sense to me, so let's try it this way:
      If your problem is that you're updating the high counter value while your count is going on but you don't want to actually SET the new counter value until you hit the maximum, you could consider using an int object - send the "next" count value (from whatever source) by sending it to the right inlet of the int object, use the third outlet (counter hit maximum) of the counter to send a bang to the int object to output whatever "new" stored max value is in the int object, and send that to either the counter object's third (update on next bang to the counter) or fourth (update immediately) inlets, depending on how you want the counter to act [you'd use the third inlet if you're driving the counter from some other source than the update from the int object, and the fourth if you want the update to immediately produce some kind of output).
    • Jun 16 2011 | 8:09 pm
      something like this?
    • Jun 16 2011 | 8:28 pm
      You could simply change the max value if the counter is at 0, like this
    • Jun 16 2011 | 8:53 pm
      The take-away lesson here?
      There is almost always more than one way to do anything.
    • Jun 16 2011 | 9:19 pm
      Thanks a lot - great feedback! :)
      @Gregory Taylor: My patch is showing three ways I tried to solve the problem. Bangs are to be generated from the big button in the top. The message boxes in the bottom show how each of the solutions fail in different ways. Of course I should have made this more clear.
      I like your thoughts on the counter - but I think I need a few days to digest them. But you're right that it's something in the high counter value / maximum I need to get my head around.
      @kochhw: Nice solution! Works! Thanks man! :D
      @broc: Yeah, that's how it should work (in my head too!). I tried out something like this. The problem is, when the max value is 3 and goes to 8, the counter doesn't get reset. So it always goes: 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 and so on.
      Until I get in depth with the details of the counter object's "high counter value" / "maximum" and how it resets - which I still hope can do this relatively simple task, without to much workaround! - I just came up with a rather simple solution, where the resetting takes place completely outside the object:
      I'm very open to more discussion and thoughts - I would really like a decent friendship with this object... :)
    • Jun 16 2011 | 10:19 pm
      note that your version has a flaw: if you paste it into an empty patcher, the first two numbers will be 0.
      this is due to missing initialization of the select object. i changed something in your version to mend this (and replaced the 2nd counter with cycle, which does the same simpler)
    • Jun 16 2011 | 11:41 pm
      I think the problem was that you were pulling the rug out from counter by setting a new max before it reset from the previous max.
    • Jun 17 2011 | 8:49 am
      @kochhw: Thanks a lot - you're perfectly right :)
      @Chris Muir: Yeah that makes sense... ahh I think the problem was, that I thought setting a new max meant resetting... things are clearing up :) Thanks for your solution, I like it!
    • Jun 17 2011 | 4:24 pm
      You can easily extend my approach for more endpoints by adding more numbers to the [sel] and increasing the modulo [%] number.
    • Jun 19 2011 | 6:55 pm
      Yep. :) But I actually combined your solution with the cycle object of kochhw's approach instead of the sel+modulo thing - even more simple!
      Just out of pure curiosity: Does the [t b b] object in your solution have anything to say?
      Thanx again guys - you're truly great - I've learned a lot!