Port MIDI support from xnp2.