You might be able to get away with a 240 ohm, but MIDI usually uses 220.
The reason for this is that MIDI is designed to drive Opto Isolators, which are basically an LED and LDR in a chip.
So when that output socket is plugged into some other MIDI equipment, and a signal is sent, the current flows through the circuit, is limited by the resistor and lights the LED inside the Opto Isolator. Using a different value MAY either cause damage to the Opto or it just won't light and your signal won't pass.
yan_g:
Can I replace the 220 ohm resistor in that circuit with a 240 ohm resistor? What is this resistor for?
Say you buy 5% resistors. The highest a 220 ohm resistor might actually be is 220 * 1.05 = 231 ohms.
The lowest a 240 ohms resistor might be is 240 * 0.95 = 228 ohms.
Therefore it can't be too critical which one you use.