if signal is greater then threshold close gate~ for period of time -> ?

Wojciech Morawski's icon

Hey!

I've got simple problem but I can not find a simple answer.
I would like to make a patch which do this simple operation

each time an audio singal is greater then threshold close gate for 100 ms

It's not a big deal to make it like this

[>= threshold] - [gate~] - [edge~] - and bang from edge~ closes gate~
simple.

but how to solve the problem and stay in signal domain?
Thanks!
wo

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

Not exactly what you asked for, but here's a useful "ducker~" abstraction I keep on hand, for suppressing signals below a specified threshold. I think you could use

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

This does what you want

Wojciech Morawski's icon

Thank you very much John!

Wojciech Morawski's icon

Hey guys, I've got one more question
cause I've got that feeling that I am missing something.

sah~ is ok if you want to sync your signal to other one with freq of control signal
but what if you wont to sync it to the event not to freq of control signal
or even worse - you want to mix those to approaches

for example you can send "clear" msg to dealy~ (John's example) but once again you are going out from dsp chain to shake hand with scheduler

so how to managed complicated logical msp systems which do not produce sound at all - only transitions from 0 to 1 to 0 and so on

have got any examples, tutorials, advices?
or maybe it is time to dive in gen~?

thanks once again!

Christopher Dobrian's icon

OK, I won't ask why you want "to manage complicated logical msp systems which do not produce sound at all." :)

As you no doubt know, the logical operators such as >~, ==~, etc. generate 0 or 1 based on their input values. The delta~ and change~ objects are also good for observing what happens in a signal. And sah~ is good for sustaining an instantaneous sample value. phasor~ and count~ are good for cyclical/periodic recurrences at a specific interval of time, and delay~ allows you to offset a signal by a precise amount of time.

So it's all just a matter of imaginatively combining those to do whatever task you're trying to do. Here's a patch that demonstrates a few tricks, and also shows a solution to your original question.

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

(Oh, and yes, gen~ can be quite handy for this kind of stuff.)

Sergio Granada-Moreno's icon

Great examples Christopher! Cheers,

Roman Thilenius's icon

you can control gate~ with line~ or index~ /~