Attached is a simple template of my current approach.
MonoSynth.csd (1.4 KB)
It’s basically a combination of:
massign
to send all notes to instr 1
active
(i-rate version) to test if this is the first note played in instr 1
instr 1
can play multiple notes, instr 2
only one
active
(k-rate version) in instr 2
to check if all MIDI notes have been released, reflected in the number of active instances of instr 1
It uses a feature of a global variable in multiple playing instances of an instrument in that the most recent instance will determine the actual value of that global variable received in other instruments. This feature means that the last note played will determine the pitch of the monophonic synthesiser.
Things can get a little more complicated if instr 2
uses a long release time and you may want to make adjustments. release
can be used to test whether an instr 2
is in its release stage and then use that to determine conditional behaviour.