Keyboards connected to GP and MOTU device

Hello Vendes, I have been thinking about the problem of releasing the notes before the redirection. I was thinking about an off message at the time of the change. The point is to combine VST with different midi modules through a MOTU brand midi equipment, and change the sound (Synth) as I change the variations. I’m going to try my rudimentary way of programming and then I’ll upload the script so you can help me improve it. Thank you all