Audacity cannot record MIDI. It can only reproduce it if you import it. Audacity cannot be directly controlled by a MIDI controller either.