how to write a midi file. Working with MIDI data in Python using Mid