Forums > Gen

[gen] latch function– any ideas?

August 11, 2012 | 9:08 am

Just wondering….
well I’ve been at a loss how to do this, seem to be going around in circles, maybe someone can help.

Consider this: A single sample impulse (say from click) is used to make an output stream raise from zero to 1. Subsequent clicks are ignored until the stream is reset to zero after a certain amount of time. Seems simple, and I’m sure it is but I can’t figure it out.
thanks……in…….advance……


August 11, 2012 | 9:30 am

I’ve been battling the same issue (though slightly different terms) – perhaps my attempts will be helpful. Not triggered from click, though, mine was meant to function as a phasor~ replacement, and will automatically start a new ramp once the ‘certain amount of time’ has passed.

Still, I don’t like my approach – it feels VERY clunky and has some of it’s own issues (phase resetting is merely a delay, not an actual phase amount, and so it cannot be adjusted in ‘real time’).

– Pasted Max Patch, click to expand. –

Also I barely remember how it actually works – but I’m using two internal accumulators – one to output the actual ramp, and another that counts until it matches the ‘stall’ time needed after a ramp. If you hook up a number box or some form of changing number to a ($1 reset) message box and feed that in, you can restart all the accumulators.


August 13, 2012 | 2:05 am

Thanks MuShoo, I managed to work it out after looking at the way you used the accum and history operators.

I’ve made it so you can cascade the gen latch subpatches to control polyphony as illustrated in this patch (might be useful to someone):

– Pasted Max Patch, click to expand. –

btw maybe the c74 people could code up a gen latch operator (and an msp external version as well). It’s a pretty fundamental function really– surprised there hasn’t been one made yet…


August 13, 2012 | 5:11 pm

Not sure if this is what you wanted, but it’s a basic latch:

– Pasted Max Patch, click to expand. –

August 13, 2012 | 11:31 pm

Thanks Graham– it’s much simpler than my version.
T


Viewing 5 posts - 1 through 5 (of 5 total)