Example #1
0
    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])
Example #2
0
def MidiNoteOff(key):
    return PmEvent.create_note_off(key)
Example #3
0
def MidiNoteOn(key, velocity):
    return PmEvent.create_note_on(key, velocity)