Ports
MidiIn
Bases: _MidiPortMixin
, Input
MIDI input port. Produces MidiMsg
objects.
Parameters:
-
port_name
(str
) –MIDI input port name
-
virtual
(bool
, default:False
) –Create virtual port (Linux and macOS only)
calls
Message match arguments and callables that will be called with matching incoming messages.
None
conditions matches any message.
attached_passthrough_outs
MidiOut
ports attached as pass-through ports
which will send all incoming messages as soon as they arrive before sending them to calls
passthrough_out
subscribe
subscribe(
type: None | Container | MidiType = None,
channel: None | Container | int | tuple[int, ...] = None,
data1: None | Container | int | tuple[int, ...] = None,
data2: None | Container | int | tuple[int, ...] = None,
) -> Callable
Decorator to subscribe a callable to the input's messages.
Decorator without arguments subscribes a callable to all the input's messages.
Decorator with arguments subscribes a callable to the input's messages
that match conditions set by arguments.
It works the same way as message's matches
method:
-
If condition is
None
or omitted it matches anything. -
If condition equals attribute it matches the attribute.
-
If condition is a container and contains the attribute it matches the attribute.
Examples
- Calls function for all MIDI port's messages:
- Calls function for OSC messages from specific address:
- Call object instance method for MIDI port's "note on" and "note off" messages:
Returns:
-
Callable
–Subscribed callable.