counter.pd
working with pure data after a long long span
can somebody help me in this counter why i can't reset the counter back to zero
thanks
-
cannot reset the counter
-
The problem seems to be that you are sending two values to the same inlet at the same time, and the one coming from the [+] object takes precedence (?).
I take it you want the counter to repeat a fixed cycle?
The easiest way to have a count restart from zero while running is to hook up a [%] object after the [+] like this:
-
Another way around it more true to your original design is to delay the bang that triggers the reset message like this:
The trade off (?) is that it takes two metro ticks (i.e the counter will output 4 before resetting)
-
@bocanegra [trigger] should always be used instead of [delay] when the order of operation is to be controlled.
-
@ingox yes indeed. But in this particular case (feeding bangs from the select object back into the counter) how would you solve the problem with a trigger?
The simple solution is to avoid that feedback loop altogether by introducing a % object in side the counter loop like I first suggested.
But if you for some reason want your select object to control the counter reset, you run into some weird behavior that is only ameliorated by a crude delay. I would like to be wrong about this, so by all means give it a go with triggers
-
@bocanegra Just removing the [delay] should be ok.
-
@bocanegra This use of trigger ensures that the select output always overwrites the [+ ] output. But if the [+ ] increment causes the counter to never land on 3, then it would never reset. It's hard to believe that this was the original intent, but who knows? @maddynakedymaddy?
-
@ingox, if you run the patch posted by OP you will see that it doesn't reset unless you bang the [0 ( message box out of sync with the metro. This makes sense as the last message sent to the [float]'s right inlet will be passed to it's outlet on the next bang from [metro].
The issue here is that of feedback in the message domain, and if you want your select module to control when to reset the counter- that is to say if you want to feed back the result of an evaluation of the counters output to the [float] that does the counting - the delay is needed. As far as I can tell at least.
Trying out other solutions produce weird results like select showing the output to be both 0 and > 3 at the same time, while the number box is showing zero, but continues from whatever high value it reached at the same time once you unhook the [0( message - try this at home:
-
@jameslo Eureka!
But if the [+ } increment caused the counter to never land on 3, then it would never reset.
The select output that triggers the reset is the last one i.e anything but 0 1 2 3, so not an issue
-
@bocanegra Duh, you're right. I'll never learn: don't post during or after cocktail hour.
-
@jameslo you still win this round
-
@bocanegra No way, @ingox got to it first
-
@jameslo I didn't really get it, not even opened @maddynakedymaddy's patch. The phenomenon is really surprising. But [float] schedules the number for both connection, gets updated to zero, but again based on the previous number.
Well, [trigger] solves it thankfully.
-
Thankyou
@bocanegra, @ingox and @jameslow super thankyou to all of you for suggesting the solution.
using the trigger after the float object never occured to me though it works fine .
I got a solution with % while probing with the patch later on but the solution with delay and trigger is something that didnt occured to me
So a huge huge thanks and for the super discussion.