def poll(self): if not self.midi.Poll(): return data = self.midi.Read(1) data_type = data[0][0][0] data_note = data[0][0][1] data_vel = data[0][0][2] print "data %s, %d" % (data, data_type & 0x90) if (data_type & 0x90) > 0 and data_vel > 0: # note on return note(data_note, data_vel)
def poll(self): """ used in markov-learner -- can we refactor? """ if not self.midi.Poll(): return data = self.midi.Read(1) data_type = data[0][0][0] data_note = data[0][0][1] data_vel = data[0][0][2] if (data_type & 0x90) > 0 and data_vel > 0: # note on return note(data_note, data_vel)