[Counter] Doesn't Count First Bang?

Joe Kaplan's icon

I've noticed that the [counter] object doesn't count the first bang it receives in the left inlet.

This seems to only apply when the minimum is set to zero. If the minimum is something other than zero, everything behaves as expected. But if the minimum is zero, the first bang seem to be ignored?

It all works normally after a reset. It's only the first bang on startup when the minimum is zero that seems to be a problem.

I guess there are ways to accommodate this, but I don't understand why it's doing this.

You can even observe this behavior in the [counter] autohelp.
Could someone clarify what's actually going on here? I think understanding what's really happening here would save me some debugging time whenever I try to use a [counter].

Max Patch
Copy patch and select New From Clipboard in Max.

Joe Kaplan's icon

Nevermind. I guess the first bang always sets the counter to the minimum.
The second bang increments it from the minimum.

So if the minimum is 0. First bang sets 0. Second bang sets 1.

I was misled because the numberbox defaults to 0, but the value stored in counter initially is null, not 0.
if you mov the numbx to some other value and then bang the counter, you'll it see it sets to zero.

So basiclaly, you have to remember the counter is initialized with a "null" value, not with the minimum value. So the first bang int he left inlet is just like a reset, it sets the counter to the min.

Tash Kings's icon

Hi Joe,

I've also come across this problem in my patch and it is a bit annoying.


A quick fix would be to trigger the 0 message box to reset the counter to the null value but also use the left inlet to push the 0 message at the same time. This bypasses the null value and you are able to start the first bang as 1.

Hope this is helpful for future projects :)