retrait TODO.
[minwii.git] / src / mxmMidi / example_print_channel_0.py
1 from MidiOutStream import MidiOutStream
2 from MidiInFile import MidiInFile
3
4 """
5 This prints all note on events on midi channel 0
6 """
7
8
9 class Transposer(MidiOutStream):
10
11 "Transposes all notes by 1 octave"
12
13 def note_on(self, channel=0, note=0x40, velocity=0x40):
14 if channel == 0:
15 print channel, note, velocity, self.rel_time()
16
17
18 event_handler = Transposer()
19
20 in_file = 'midiout/minimal_type0.mid'
21 midi_in = MidiInFile(event_handler, in_file)
22 midi_in.read()
23