convert bang to 1 and 0 values

Mxme Pr's icon

Hey,

quite simple ask : I want to use a bang to open and close a gate. If I send a bang to a toggle then it's like every other bang is opening the gate (one bang is 1 and the next one is 0). I'd like to be able to use bang like that : outputs a 1 when there's a bang, output a zero in between bangs. So every bang would output a 1 first and then a 0, kinda like a note on note off thing. How can I do that?
Thanks a lot :)

Source Audio's icon

insert toggle

Mxme Pr's icon

@SourceAudio can you elaborate please? I don't understand...

Mxme Pr's icon

follow up question : Bang into click~ works but click~ doesn't show any value when plug into a number~ box...I guessed click~ would have 2 values, 0 and 1...but the number~ box show only 0 although I see click~ working just fine with a scope...

Roman Thilenius's icon

1.) toggle or counter.

2.) number~ only shows the exact signal value every now and then, so it is quite hard for it to catch the click.

Source Audio's icon

every max object has help and reference.
read that first, when you want to use objects.

number~ is too slow to show short click~


Pedro Santos's icon

You didn't specify the interval between turning the gate on and then off. In this example I'm assuming 100 ms. Is that it?

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

Mxme Pr's icon

Thanks Pedro Santos, that's exactly what I wanted!!

Andy Maskell's icon

Or you could do it like this: