add MIDI input and output support

The reason to fail to transmit MIDI output with previous commit is
the wrong way to use bit operator.