Non-looping count~

wellis's icon

Apologies if this has been answered a million times before, but I just can't find anything that tells me how to get count~ to stop once hitting its maximum.

From the documentation, "It can be set to loop..." - I can't see how it doesn't loop?

Thanks in advance and apologies if this is a daft question, I'm just getting started.

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

If you just want it not to loop, don't set a maximum. But if you want it to count from a to b, you can send its output through a gate~ and close the gate~ when you hit b. Something like this:

wellis's icon

Ah, now that makes much more sense out of the "It can be set to loop" comment in the documentation! Thanks so much for the help.

wellis's icon

Cheeky follow-up question... what's the quickest (i.e. with least delay) way to send a bang following count~ hitting the "maximum" handled by the gate~?

I've been using line~ with wave~, but would prefer to use count~ with index~ and the main functional difference is that line~ bangs on finishing its ramp.

The obvious options are to use number~ or snapshot~, but I was concerned that these would introduce a meaningful delay, i.e. more than a handful of samples?

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

The edge~ object is probably your best bet. It will give you a bang that is accurate to within the duration of one signal vector.

wellis's icon

Brilliant, not sure how I missed that one, but looks really handy.

Roman Thilenius's icon

otherwise you could also make it stop by using [maximum~ 123456] or multiply its output by the output of [>~ 123456]

-110

Emmanuel Jourdan's icon

just for fun, here's a gen~ example:

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