Skip to content

Instantly share code, notes, and snippets.

@tleyden
Created June 30, 2015 02:30
Show Gist options
  • Save tleyden/018b700114a67cf9bfe3 to your computer and use it in GitHub Desktop.
Save tleyden/018b700114a67cf9bfe3 to your computer and use it in GitHub Desktop.
from MidiOutStream import MidiOutStream
from MidiInFile import MidiInFile
class NoteOnPrinter(MidiOutStream):
"Prints all note_on events on channel 0"
def note_on(self, channel=0, note=0x40, velocity=0x40):
if channel == 0:
print channel, note, velocity, self.rel_time()
event_handler = NoteOnPrinter()
in_file = 'midiout/minimal_type0.mid'
midi_in = MidiInFile(event_handler, in_file)
midi_in.read()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment