refactor MIDI