a system that makes two bangs registered close in time to produce a bang-how to?

Rom's icon

Hello guys,

I’m trying to set up a system so when for example 2 bangs are received under 1 second (close in time to each other) than the system will send out a bang that will activate a toggle or whatever. But if they were banged with a gap between them for example 2 or 3 seconds between each bang than it wouldn’t trigger the toggle/bang.

Thank you for your help it is much appreciated.

Pedro Santos's icon
Max Patch
Copy patch and select New From Clipboard in Max.
Stephane Morisse's icon
Max Patch
Copy patch and select New From Clipboard in Max.

[onebang] is your friend.

Rom's icon

Thank you both, this is what i was looking for. cheers

Roman Thilenius's icon

or

[t 1]
[thresh 5.]
[select list]

-110

Rom's icon

Hey Guys,

Currently the patch that Pedro Santos posted was the behavior that I was after.
Now I’m trying to take this further, and make it so for example only after 4 bangs that are banged less then 800ms then it will output a bang.
The reason why it works great with how Pedro set it up that every 2 bangs in less than 1s is because the timer object measures the time different between two events.

In order to make it so it will bang after 4 bangs, I tried to play with the counter object but no success yet.
Hopefully someone will know how to set this up.

Thank you very much!

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

You could try putting a [cycle] object before your timer...

Rom's icon

Thank you kodamapixel, that’s a good progress. Let me make it a little bit more difficult and tell me if this is possible:

So now the cycle is cycling between 4 bangs and we take only the first and last to the timer object, and it works well.

The behavior that would make it perfect is that if I haven’t banged in a short period, the cycle will reset itself to the first bang. At moment if I bang twice and wait, when I’ll bang again it will start from the previous one, which again like I said I’m looking for a way to reset it after it didn't receive a bang for lets say 2 seconds.

Possible?
Thank you!

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

use clocker to reset :

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

Hi again, ROM. Just reset the cycle if more than 1 second has passed since the first bang. Contrary to timer, clocker reports time at regular intervals.

Pedro Santos's icon

Achzo won, he answered first with the exact same solution, with the only difference being that I turned off the clocker, but it should be irrelevant performance wise...

Rom's icon

thank you very much for your help!