MIDI isn't music. MIDI is machine control. So the job is to make the keyboard play a machine with MIDI software, like Windows, to make music and then make Audacity record Windows.
https://manual.audacityteam.org/man/tut ... puter.html
http://donyaquick.com/midi-on-windows/
There is one really odd duck problem with MIDI management. The sound isn't coming from MIDI. The sound is coming from the machine that MIDI is playing. So if your song calls for instrument number 24 (Guitar) on three different machines, you could get three different guitars.
There's a less obvious problem where you can't start with a musical performance by somebody else and
"convert" it to MIDI. You can make a MIDI song with
your MIDI keyboard.
I'm not so sure how you might play harmony with yourself. Overdubbing may be out of play. You can make a backing track by playing your keyboard to Windows and then make Windows play to Audacity. But the second track means Audacity has to play the backing track to your headphones while you play the second track to Windows and to Audacity.
I don't think you can do that. Someone will correct me.
Koz