You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
543 B
Python
26 lines
543 B
Python
import sys
|
|
sys.path.append("midi")
|
|
from MidiOutStream import MidiOutStream
|
|
from MidiInFile import MidiInFile
|
|
|
|
"""
|
|
This prints all note on events on midi channel 0
|
|
"""
|
|
|
|
|
|
class Transposer(MidiOutStream):
|
|
|
|
"Transposes all notes by 1 octave"
|
|
|
|
def note_on(self, channel=0, note=0x40, velocity=0x40):
|
|
if channel == 0:
|
|
print channel, note, velocity, self.rel_time()
|
|
|
|
|
|
event_handler = Transposer()
|
|
|
|
in_file = 'nevergoingtoU.mid'
|
|
midi_in = MidiInFile(event_handler, in_file)
|
|
midi_in.read()
|
|
|