The MIDI specification suggests a fast switching diode to protect the optocoupler's LED against ESD that could exceed its reverse voltage:
But this is the only diode used; I could simplify the BOM if I could replace it with some component already used elsewhere in the circuit. So why not use a PN junction of a general-purpose transistor?
Compared to the 1N4148, the 2N3904 has smaller reverse breakdown voltages, but this would not matter in this application because the LED clamps such voltages. Other parameters like capacitance or maximum current are comparable. So this looks as if the transistor would work, wouldn't it?
And which junction should be used, base/emitter, base/collector, or both? And what to do with the unused junction?