Classes to transmit and receive MIDI messages over USB
-
class
usb_midi.PortIn
Receives midi commands over USB
-
read(self, nbytes: Any = 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(self, buf: Any, nbytes: Any = 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
-
class
usb_midi.PortOut
Sends midi messages to a computer over USB
-
write(self, buf: Any)
Write the buffer of bytes to the bus.
- Returns
the number of bytes written
- Return type
int or None