I'm doing some MIDI experiments with Raspberry Pi. Here I go over how to use MIDI in over UART via the Pi 3 or 4's GPIO pins; including the hardware and software setup.
GitHub repo: https://github.com/BlitzCityDIY/midiExperimentsWithRaspberryPi
Resources
Official Raspberry Pi UART Documentation: https://www.raspberrypi.org/documentation/configuration/uart.md
py-midi Library: https://pypi.org/project/py-midi/
Older MIDI In Guides and Documentation for Raspberry Pi: http://www.samplerbox.org/article/midiinwithrpi https://www.instructables.com/id/PiMiDi-A-Raspberry-Pi-Midi-Box-or-How-I-Learned-to/ https://openenergymonitor.org/forum-archive/node/12412.html