Implementation of Midi / MidiFile reading and writing