MIDI to Arduino with a 4N38 Optocoupler
R2 is too large.
The specification specifies 220 Ω to get 5 mA; smaller currents just make the output transistor weaker.

R3 is wrong.
A base-emitter resistor could be used to allow the charge to be removed faster from the saturated base when switching off.
However, such a resistor also adds a minimum threshold for the base current (because no current will go into the base until the voltage drop over the resistor is large than the base-emitter voltage).
This would be acceptable with a Darlington optocoupler like the 6N138, due to its high amplification, but with a simple phototransistor, that current is so small that it is unlikely that the transistor will ever turn on.
Remove R3 altogether, or try a large value like 1 MΩ and go down from that.

The pull-up resistor R1 looks OK.
But you might want to try a smaller value like 100 Ω, just to be sure.



At 31250 baud, one bit has a length of 32 µs.
For reliable operation, the raise/fall times of your optocoupler's output must be much less than that; the MIDI specification recommends less than 2 µs.

A simple transistor optocoupler is unlikely to be fast enough.

The 6N138 uses a photodiode, but its Darlington output is too slow for MIDI unless you add more components (e.g., a base/emitter resistor) to speed it up.

The best optocoupler to use is a high-speed optocoupler with a logic output.
Just use the one from the MIDI specification (note: "PC900" is Sharp's way of spelling "H11L1", which is made by many manufacturers).