PortIn – receives midi commands over USB

class usb_midi.PortIn

You cannot create an instance of usb_midi.PortIn.

PortIn objects are constructed for every corresponding entry in the USB descriptor and added to the usb_midi.ports tuple.

read(nbytes=None)

Read characters. If nbytes is specified then read at most that many bytes. Otherwise, read everything that arrives until the connection times out. Providing the number of bytes expected is highly recommended because it will be faster.

Returns:Data read
Return type:bytes or None
readinto(buf, nbytes=None)

Read bytes into the buf. If nbytes is specified then read at most that many bytes. Otherwise, read at most len(buf) bytes.

Returns:number of bytes read and stored into buf
Return type:bytes or None