A counter~ that stops at the end

Chris Muir's icon

I'm looking for something like counter~ with the added feature of having it stop when it reaches the upper limit.

I'm trying to record little audio snippets after they're passed through a VST. I'm using counter~ and poke~ to move the audio into a buffer, and it's working other than the fact that the only way I have to stop counter~ is not at signal rate, so there's some indeterminacy in when it actually gets stopped, consequently the beginnings sometime get overwritten because counter~ loops.

p.s.
It would be nice if the forum software would not return results for counter, given a search term of counter~

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

Something like this will work if you're willing to give up the first sample of your buffer as a holding place for all the stuff you don't want to poke. (When gate~ is closed it sends out 0.)

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

Thanks for that, Christopher. I had something pretty similar, only it used selector to deliver -1 to poke~ when it wasn't writing. I think that my original thing was working fine, and that that wasn't really the problem with my patch. I was miscalculating the latency through my signal chain.