/src/echonest/support/midi/example_print_file.py

http://echo-nest-remix.googlecode.com/ · Python · 19 lines · 5 code · 3 blank · 11 comment · 0 complexity · 22900f3e44b05192f246d05b77cca44c MD5 · raw file

  1. """
  2. This is an example that uses the MidiToText eventhandler. When an
  3. event is triggered on it, it prints the event to the console.
  4. It gets the events from the MidiInFile.
  5. So it prints all the events from the infile to the console. great for
  6. debugging :-s
  7. """
  8. # get data
  9. test_file = 'test/midifiles/minimal-cubase-type0.mid'
  10. # do parsing
  11. from MidiInFile import MidiInFile
  12. from MidiToText import MidiToText # the event handler
  13. midiIn = MidiInFile(MidiToText(), test_file)
  14. midiIn.read()