Hi, interesting question!
First, you should create a route in the MIDI router from the incoming MIDI port (e.g. MT Virtual 1) to the outgoing MIDI port (e.g. also MT Virtual 1).
Then, create a new preset. Open the preset properties and set the Preset Default Ports to the input and output port you'll be using, e.g. MT Virtual 1 for both.
Now add these three translator entries:
Code: Select all
Translator 0: Play pending Note Off
Options: swallow=true, stop processing=false
Incoming: MIDI 90 pp qq
Rules:
Label "ignore Note Off"
if qq==0 then exit rules, skip Outgoing Action
Label "if no pending legato note, do not stop current legato note"
if g0==0 then exit rules, skip Outgoing Action
Label "reset pending note off"
pp=g0
g0=0
Outgoing: MIDI 90 pp 00
Translator 1: Play new note
Options: swallow=true, stop processing=false
Incoming: MIDI 90 pp qq
Rules:
Label "ignore Note Off"
if qq==0 then exit rules, skip Outgoing Action
Label "remember the currently playing note"
g0=pp
Outgoing: MIDI 90 pp qq
Translator 2: Swallow other Note Off
Options: swallow=true, stop processing=false
Incoming: MIDI 80 pp qq
Outgoing: None
Both translators don't do anything for Note On with zero velocity (i.e. Note Off). The "normal" note off message is swallowed, too.
Now the first translator will check if there is a pending note in the global variable g0. If it is 0, the translator will bail out and not do anything.
Otherwise, it will set pp to g0 (so that pp has the note number of the pending Note Off), and reset g0 to 0. Then it will send out the MIDI message for Note Off, using the note number in pp and zero velocity.
The second translator will remember the note that is played in g0 and play the note.
This preset will also (inevitably) remove all polyphony: only the last note will sound.
And there is one flaw: you cannot stop the sound! (see next post).
Florian