refactor MIDI playback functions
add command line argument handling