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.
24 lines
574 B
Python
24 lines
574 B
Python
15 years ago
|
import sys
|
||
|
sys.path.append("midi")
|
||
|
from MidiOutStream import MidiOutStream
|
||
|
from MidiInFile import MidiInFile
|
||
|
|
||
|
class ArduinoConverter(MidiOutStream):
|
||
|
|
||
|
"Convert MIDI stream to some weird format I can actually use"
|
||
|
|
||
|
def note_on(self, channel=0, note=0x40, velocity=0x40):
|
||
|
if self.get_current_track() == 3 and channel == 0:
|
||
|
print note, self.rel_time()
|
||
|
|
||
|
def sysex_event(self, data):
|
||
|
"dummy"
|
||
|
pass
|
||
|
|
||
|
# get data
|
||
|
test_file = 'nevergoingtoU.mid'
|
||
|
# do parsing
|
||
|
c = ArduinoConverter()
|
||
|
midiIn = MidiInFile(c, test_file)
|
||
|
midiIn.read()
|