timidity++ http://timidity.sourceforge.net/is a synthesizer that can play midi files and convert them to wav.
aseqview, vkeybd
https://www.classicalarchives.com/midi.html
amidi -l or aplaymidi -l shows the available alsa midi ports
aplaymidi -p 24:0 midi_file.mid will play the midi file to the port 24:0 in this example.
There are soundfonts that turn midi comands into a sound.
Some soundcards have midi interfaces. There are also midi USB interfaces available. A midi usb standard exist, when following this standard they are inter changeable and therefore promising to be used under Linux. Different arduino projects exist to have such usb to midi device.
Finally there are virtual Midi devices so midi can be used without having it.