There are currently two ways to export MIDI.
XRNS-PHP: https://forum.renoise.com/t/xrns-php-using-windows/20469
.NET Renoise Tools: https://forum.renoise.com/t/nrenoisetools-a-renoise-xrns-xrni-library-and-tools-in-net/23155
I’m guessing you already knew that and you still want it “inside” renoise, but I fail to see why. Probably took longer to post with “rolling eyes smilies” than to figure out the above two tools.