How to better write Ryoji Ikeda/Alva Noto Style Synth

What is most likely the problem is the scope of the variable synth1 which I suspect is only locally declared and thus not seen by the MIDIdef. Also, I would not use Server.freeAll as it brings all sounding synths to an abrupt end, better to use ~mySynth.release or ~mySynth.set(\gate, 0);