[gen] latch function– any ideas?

Aug 11, 2012 at 9:08am

[gen] latch function– any ideas?

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……

#63933
Aug 11, 2012 at 9:30am

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.

#230536
Aug 13, 2012 at 2:05am

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…

#230537
Aug 13, 2012 at 5:11pm

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

– Pasted Max Patch, click to expand. –
#230538
Aug 13, 2012 at 11:31pm

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

#230539

You must be logged in to reply to this topic.