Using keyboard-style 2-pin mechanical switches with daisy and plugdata

Hi I am tying to use my mechanical key as a momentary button as a gate for letting audio pass from ADC to DAC. It works well when I have r button1 @hv_param going to a toggle then to the right inlet of the *~ between ADC and DAC however I cannot for the life of me figure out how to make it momentary. Ive tried changing the toggle to a bang, Ive tried changing the “switch” in my json to a “GateIn” and nothing seems to work. Ive scoured the internet trying to find a solution. Please help!

use r button1_press @hv_param and wire it via a line~ to the multiplier like so:

See the component reference documentation: Custom JSON | hvcc

thank you so much! that worked! some questions about hat patch. How do I know when I need to use “r button1_press” vs “r_button1”? Also kind of confused about what the “$1 20” message box and the line~ are doing in this patch

See the component reference, adding _press changes the type of output you get from the switch type component. There are also _fall and _seconds alternatives.

The message and line~ are to ensure that you are sending a smooth out signal to the multiplier, this prevents clicks and other unwanted effects. With this in between it takes 20ms for the value to change (you can lower it, but I recommend to always put a line~ like this when going from control to signal rate in a patch)

awesome, thanks for the info!

1 Like