[count] object always stutts

7391's icon

Hello

I have a problem with [count] driven by a signal. I want to reset this object decently in some kind of loop use. If I am right, the only way to do this is to send a 0 signal to it. I'm pretty sure to send only one sample at 0, the others are at 1 - I used the capture object to check. But when I do that, the object first stops (+ resets) and then starts to count again resulting two successive 0 in counting.

Is there a way to do it cleaner ? I mean with only one 0 ?

Thanks for any help
A patch is attached that shows the thing

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

christripledot's icon

sorry, no example patch cos i don't have max on this machine, but...

use [+=~] instead of [count~]. send a constant [sig~ 1.] to one input of a [bitxor~], and a [click~] to the other. also connect the [click~] to the right inlet of [+=~]. connect the output of [bitxor~] to the left inlet of [+=~]. voila! one click-resettable zero-indexed sample counter.

hope this helps :)

7391's icon

Thanks a lot Chris...

It works very well, the [+=~] don't do the 0 twice on reset.

I have to check in my original patch now if I can use it like this since I use the 'maximum' argument of count

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

Here's the patch as you explained it :

christripledot's icon

that's it, you got it!

regarding the count limit, that's a bit tricky...

you could always modulo the output of [+=~] with [%~], but eventually you will run out of precision i think. but if you are re-triggering every now and then it shouldn't be a problem.

christripledot's icon
Max Patch
Copy patch and select New From Clipboard in Max.

or this might do instead:

7391's icon

Oh ! That's great, Chris…
Thanks again
Have a nice day… or night.

christripledot's icon

glad to be of help :)