added mastering and storing MIDI in file buffer