python - Sending and receiving MIDI sync data -
i want send mmc cubase tell start, stop , rewind, , cubase sends timecode program keep in sync. script works flawlessly, other times gets blocked somehow , stops responding, while midiox shows me cubase continues send midi timecode - not 100 per second, 1 every 3 seconds! cubase have higher priority , script not allowed process input, gets blocked? except doesn't me flush messages. ideas?
import time import rtmidi md mtcin = md.midiin() mout = md.midiout() mtcin.ignore_types(sysex=false, timing=false) mtcin.open_port(0) mout.open_port(3) event_list = [(0,123),(0.13,234,45),(1.5,345,56),(3,14)] ind = 0 timecode = -1 mout.send_message((0xf0, 0x7f, 127, 6, 2, 0xf7)) while ind < len(event_list): msg = mtcin.get_message() if msg: timecode += 1 if event_list[ind][0] <= timecode/100.0: print event_list[ind][1:] ind += 1 time.sleep(0.001) mout.send_message((0xf0, 0x7f, 127, 6, 1, 0xf7)) mout.send_message((0xf0, 0x7f, 127, 6, 0x44, 6, 1, 32, 0, 0, 0, 0, 0xf7))
Comments
Post a Comment