Turning Momentary Footswitch into Latching using gen~

Hello!

Beginner here. So far I’ve been able to flash patches to the pedalpcb terrarium and map controls to it using the terrarium json. I’m trying to turn the momentary footswitch that’s built into the terrarium as a latching footswitch to toggle the pedal on/off. Just as an example, here’s a simple delay with 1 path through the effect and one path directly to the output. Could someone please help me use param fs1 to latch the effect on/off? I’m hoping I can use the latch object that’s inside of gen~.

Thanks for the help!

Welcome!!

If the [param fs1] is outputting 1 when pressed down and 0 when let go, the following patch may get the job done!

The [sig~] object (with 0 and 1 messages) in the parent patch is just used to emulate the footswitch. When you go from 0 to 1, the output will toggle between 0 and 1. So, the first time you go from 0 → 1, [wrap 0 2] will output a 1. And then when you do 0 → 1 again, 0 will be the output. And so on!

From there, you can use that (with a bit of slew limiter) to perhaps switch between bypass signal path and effects path! For testing, you can connect the output of [wrap 0 2] to the second inlet of [*] and turn on/off the input sound (or an oscillator for easier testing).

I hope I understood what you are trying to achieve. Let me know how it goes!!

I was able to get it working using the patch you showed. Thank you so much for the help!

1 Like

Happy to help :slight_smile:

1 Like

I used sah to do the same.

1 Like