/src/echonest/support/midi/example_mimimal_type0.py

http://echo-nest-remix.googlecode.com/ · Python · 29 lines · 12 code · 10 blank · 7 comment · 0 complexity · 1f990056ef5a552661d98609961cc427 MD5 · raw file

  1. from MidiOutFile import MidiOutFile
  2. """
  3. This is an example of the smallest possible type 0 midi file, where
  4. all the midi events are in the same track.
  5. """
  6. out_file = 'midiout/minimal_type0.mid'
  7. midi = MidiOutFile(out_file)
  8. # non optional midi framework
  9. midi.header()
  10. midi.start_of_track()
  11. # musical events
  12. midi.update_time(0)
  13. midi.note_on(channel=0, note=0x40)
  14. midi.update_time(192)
  15. midi.note_off(channel=0, note=0x40)
  16. # non optional midi framework
  17. midi.update_time(0)
  18. midi.end_of_track()
  19. midi.eof()