Using a Keyboard Note to Activate A Momentary Switch While Held Down

Patrick Mattingly's icon

I have a MIDI note, let's say 45, and while I'm holding down the key, I want a momentary switch to be ON and when I let off the key I want the momentary switch to be OFF.

Does anyone know how to do this?

Thanks.

dequalsrxt's icon

A comparator and a gate?

Christopher Dobrian's icon

Here's a simple way.

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

motor man's icon

here with simple logic

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