speed limiting pseudo bangs in Gen?

jayrope's icon

Is there a way to speed limit pseudo triggers in Gen?

While comparing RMS to peak values my gen generates a 1 upon peak value exceeding a threshold value, else resulting in 0. Using this to pseudo-trigger an ADSR.

The mechanism generates way too many pseudo-triggers per time, obviously, as any hit on a contact mic for instance generates several triggers in very short intervals, of which i actually only need the first one, but suppress the rest of that sequence.

I'd like to limit the occurrence of 1 in a signal flow to appear only once,
if the last appearance was less than let's say 100 ms before.

I know it must be a simple (codebox?) thing, but can't seem to be able to wrap my hand around this.

Thank you for any insight.

jayrope's icon

Here's a patch, which makes this problem visible. I can limit the speed of triggering, but end up having no triggers left at all, when speed gets too high.

Please look at this. I think i only miss a minor point in the gen~ part. But which point exactly?

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

Max Gardener's icon

use a change operator, perhaps?

Graham Wakefield's icon

Not sure if this is exactly what you're trying to do, but it's a simple trigger threshold + hold time. The main thing is to use a sample counter for the hold time that will suppress further output, but also ensure that this sample counter can only be reset once it has expired.

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

jayrope's icon

Thanks a lot for this example patch, Graham.

This is exactly, what i was looking for, and teaches me much about Gen intestines as well. Didn't realize i can do the if () things with a ? operator. Ai ai ai.

Great workshop! Are you doing this sometimes, workshops, i mean? In Berlin eventually?

jayrope's icon

I reworked Grahams patch below. Added was a random pseudo trigger generator and two scopes, so one can see, if passed through triggers are still in sync (they are).

This works nicely after this peak vs. rms trigger generator.

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