Modularizes midi generation partially

Functions for midi file generation have been partially implemented in a
stand-alone event.h file.