midi#

class platypush.message.event.midi.MidiDeviceAddedEvent(*args, device: str | None, port: int | None, **kwargs)[source]#

Bases: MidiEvent

Event triggered when a MIDI device is added to the list of available devices.

__init__(*args, device: str | None, port: int | None, **kwargs)#
Parameters:
  • device – The MIDI device name.

  • port – The MIDI device port number.

as_dict()#

Converts the event into a dictionary

classmethod build(msg)#

Builds an event message from a JSON UTF-8 string/bytearray, a dictionary, or another Event

matches_condition(condition)#

If the event matches an event condition, it will return an EventMatchResult :param condition: The platypush.event.hook.EventCondition object

classmethod parse(msg)#

Parse a generic message into a key-value dictionary

Parameters:

msg – Original message. It can be a dictionary, a Message, or a string/bytearray, as long as it’s valid UTF-8 JSON

classmethod to_dict(msg)#

Converts a Message object into a dictionary

Parameters:

msg – Message object

class platypush.message.event.midi.MidiDeviceConnectedEvent(*args, device: str | None, port: int | None, **kwargs)[source]#

Bases: MidiEvent

Event triggered when a MIDI device is connected.

__init__(*args, device: str | None, port: int | None, **kwargs)#
Parameters:
  • device – The MIDI device name.

  • port – The MIDI device port number.

as_dict()#

Converts the event into a dictionary

classmethod build(msg)#

Builds an event message from a JSON UTF-8 string/bytearray, a dictionary, or another Event

matches_condition(condition)#

If the event matches an event condition, it will return an EventMatchResult :param condition: The platypush.event.hook.EventCondition object

classmethod parse(msg)#

Parse a generic message into a key-value dictionary

Parameters:

msg – Original message. It can be a dictionary, a Message, or a string/bytearray, as long as it’s valid UTF-8 JSON

classmethod to_dict(msg)#

Converts a Message object into a dictionary

Parameters:

msg – Message object

class platypush.message.event.midi.MidiDeviceDisconnectedEvent(*args, device: str | None, port: int | None, **kwargs)[source]#

Bases: MidiEvent

Event triggered when a MIDI device is disconnected.

__init__(*args, device: str | None, port: int | None, **kwargs)#
Parameters:
  • device – The MIDI device name.

  • port – The MIDI device port number.

as_dict()#

Converts the event into a dictionary

classmethod build(msg)#

Builds an event message from a JSON UTF-8 string/bytearray, a dictionary, or another Event

matches_condition(condition)#

If the event matches an event condition, it will return an EventMatchResult :param condition: The platypush.event.hook.EventCondition object

classmethod parse(msg)#

Parse a generic message into a key-value dictionary

Parameters:

msg – Original message. It can be a dictionary, a Message, or a string/bytearray, as long as it’s valid UTF-8 JSON

classmethod to_dict(msg)#

Converts a Message object into a dictionary

Parameters:

msg – Message object

class platypush.message.event.midi.MidiDeviceRemovedEvent(*args, device: str | None, port: int | None, **kwargs)[source]#

Bases: MidiEvent

Event triggered when a MIDI device is removed from the list of available devices.

__init__(*args, device: str | None, port: int | None, **kwargs)#
Parameters:
  • device – The MIDI device name.

  • port – The MIDI device port number.

as_dict()#

Converts the event into a dictionary

classmethod build(msg)#

Builds an event message from a JSON UTF-8 string/bytearray, a dictionary, or another Event

matches_condition(condition)#

If the event matches an event condition, it will return an EventMatchResult :param condition: The platypush.event.hook.EventCondition object

classmethod parse(msg)#

Parse a generic message into a key-value dictionary

Parameters:

msg – Original message. It can be a dictionary, a Message, or a string/bytearray, as long as it’s valid UTF-8 JSON

classmethod to_dict(msg)#

Converts a Message object into a dictionary

Parameters:

msg – Message object

class platypush.message.event.midi.MidiEvent(*args, device: str | None, port: int | None, **kwargs)[source]#

Bases: Event, ABC

Base class for MIDI events.

__init__(*args, device: str | None, port: int | None, **kwargs)[source]#
Parameters:
  • device – The MIDI device name.

  • port – The MIDI device port number.

as_dict()#

Converts the event into a dictionary

classmethod build(msg)#

Builds an event message from a JSON UTF-8 string/bytearray, a dictionary, or another Event

matches_condition(condition)#

If the event matches an event condition, it will return an EventMatchResult :param condition: The platypush.event.hook.EventCondition object

classmethod parse(msg)#

Parse a generic message into a key-value dictionary

Parameters:

msg – Original message. It can be a dictionary, a Message, or a string/bytearray, as long as it’s valid UTF-8 JSON

classmethod to_dict(msg)#

Converts a Message object into a dictionary

Parameters:

msg – Message object

class platypush.message.event.midi.MidiMessageEvent(*args, message: List[int], data: Any | None = None, **kwargs)[source]#

Bases: MidiEvent

Event triggered upon received MIDI message.

__init__(*args, message: List[int], data: Any | None = None, **kwargs)[source]#
Parameters:
  • message – The received MIDI message.

  • data – Additional data associated to the event.

as_dict()#

Converts the event into a dictionary

classmethod build(msg)#

Builds an event message from a JSON UTF-8 string/bytearray, a dictionary, or another Event

matches_condition(condition)#

If the event matches an event condition, it will return an EventMatchResult :param condition: The platypush.event.hook.EventCondition object

classmethod parse(msg)#

Parse a generic message into a key-value dictionary

Parameters:

msg – Original message. It can be a dictionary, a Message, or a string/bytearray, as long as it’s valid UTF-8 JSON

classmethod to_dict(msg)#

Converts a Message object into a dictionary

Parameters:

msg – Message object