I've got this simple patch:
Now I connected a game controller to Pd where the keys give me 1 or 0 depending whether I press the button or not.
If I press my button I want the osc~ to "play" and if I release it it should stop.
BUT: I wasn't able to find a point where to attach a switch. I don't want to switch off the DSP as I want to play another sound at another key the same time.
It would be nice if anyone of you would have a solution
EDIT: Okay the below solution worked, If there is any need for the project I've done (using a game controller as an instrument) just contact me directly.
Switching a signal in Pd is done by multiplying the signal with 0 or 1. Multiplication of the signal is done with the object *~
. Since you already have 0 and 1 from your game controller, that should be easy. However, you will start to hear clicks, depending on where the sine wave is in the moment you abruptly switch it off. To fix this, ad a line~
object and ramp the oscillator in and out.