1 from MidiOutFile import MidiOutFile
2 from MidiInFile import MidiInFile
3
4 """
5 This is an example of the smallest possible type 0 midi file, where
6 all the midi events are in the same track.
7 """
8
9
11
12 "Transposes all notes by 1 octave"
13
15 if ch != 9:
16 note += 12
17 if note > 127:
18 note = 127
19 return note
20
21
22 - def note_on(self, channel=0, note=0x40, velocity=0x40):
25
26
27 - def note_off(self, channel=0, note=0x40, velocity=0x40):
30
31
32 out_file = 'midiout/transposed.mid'
33 midi_out = Transposer(out_file)
34
35
36
37 in_file = 'test/midifiles/tennessee_waltz.mid'
38 midi_in = MidiInFile(midi_out, in_file)
39 midi_in.read()
40