def read(self, num_events=4096): '''Read MIDI events and return a list of PmEvent instances :param num_events the number of events to read :rtype list of PmEvents read from MIDI Input''' num_events = min(num_events, self.buffer_size) ret = lib.Pm_Read(self.stream, self.buffer, num_events) if ret < 0: raise MidiException(errno=ret) return PmEvent.events_from_buffer(self.buffer[0:ret])
def MidiNoteOff(key): return PmEvent.create_note_off(key)
def MidiNoteOn(key, velocity): return PmEvent.create_note_on(key, velocity)