The DIN-5 MIDI ports are always either an input or output port, so they’re one-directional.
You could actually make use of Pisounds In and Out ports, and add additional input and output ports via the unused Raspberry Pi’s UART pins (with a simple circuit), see this comment: Why choose SPI over UART?