elkpy.MidiController

class elkpy.midicontroller.MidiController(address: str = 'localhost:51051', sushi_proto_def: str = '/usr/share/sushi/sushi_rpc.proto')[source]

Bases: object

A class to manage MIDI connections in Sushi via gRPC. It can create and remove keyboard, CC and PC connections from an external midi device to tracks, processors, and parameters in sushi.

__init__(address: str = 'localhost:51051', sushi_proto_def: str = '/usr/share/sushi/sushi_rpc.proto') → None[source]

The constructor for the MidiController class setting up the gRPC connection with sushi.

Parameters:
address (str): IP address to Sushi in the uri form : ‘ip-addr:port’ sushi_proto_def (str): path to the .proto file with SUSHI gRPC services definitions
connect_cc_to_parameter(processor_id: int, parameter_id: int, channel: int, port: int, cc_number: int, min_range: float, max_range: float, relative_mode: bool) → None[source]

Connects a Midi CC connection to a parameter

Parameters:
processor_id (int): The id of processor that the parameter belongs to parameter_id (int): The id of the parameter to connect to channel (int): The midi channel to use for the connection port (int): The id of the midi port to use for the connection cc_number (int): The cc number to use for the connection min_range (float): The minimum parameter value used for the connection max_range (float): The maximum parameter value used for the connection relative_mode (bool): Wether the parameter changes realative to a previous value
connect_kbd_input_to_track(track: int, channel: int, port: int, raw_midi: bool) → None[source]

Connects a Midi Keyboard input connection to a track

Parameters:
track (int): The id of the track to connect to channel (int): The id of the channel to connect to port (int): The id of the port to connect to raw_midi (bool): Enable raw midi
connect_kbd_output_from_track(track: int, channel: int, port: int, raw_midi: bool) → None[source]

Connects a Midi Keyboard output connection to a track

Parameters:
track (int): The id of the track to connect to channel (int): The id of the channel to connect to port (int): The id of the port to connect to raw_midi (bool): Enable raw midi
connect_pc_to_processor(processor: int, channel: int, port: int) → None[source]

Connects a Midi PC connection to a processor

Parameters:
processor (int): The id of the processor to connect channel (int): The midi channel to use for the connection port (int): The midi port to use for the connection
disconnect_all_cc_from_processor(processor_id: int) → None[source]

Disconnects all Midi CC connections from processor

Parameters:
processor_id (int): The id of the processor to disconnect
disconnect_all_pc_from_processor(processor_id: int) → None[source]

Disconnects all Midi PC connections from processor

Parameters:
processor_id (int): The id of processor to disconnect
disconnect_cc(processor_id: int, parameter_id: int, channel: int, port: int, cc_number: int, min_range: float, max_range: float, relative_mode: bool) → None[source]

Disconnects a Midi CC connection

Parameters:
processor_id (int): The id of the processor the parameter belongs to parameter (int): The id of the parameter to connect to channel (int): The midi channel to use for the connection port (int): The id of the midi port to use for the connection cc_number (int): The cc number to use for the connection min_range (float): The minimum parameter value used for the connection max_range (float): The maximum parameter value used for the connection relative_mode (bool): Wether the parameter changes realative to a previous value
disconnect_kbd_input(track: int, channel: int, port: int, raw_midi: bool) → None[source]

Disconnects a Midi Keyboard input connection from a track

Parameters:
track (int): The id of the track to disconnect channel (int): The midi channel to disconnect port (int): The midi port to disconnect raw_midi (bool): Disconnect raw midi
disconnect_kbd_output(track: int, channel: int, port: int, raw_midi: bool) → None[source]

Disconnects a Midi Keyboard output connection from a track

Parameters:
track (int): The id of the track to disconnect channel (int): The midi channel to disconnect port (int): The midi port to disconnect raw_midi (bool): Disconnect raw midi
disconnect_pc(processor: int, channel: int, port: int) → None[source]

Disconnects a Midi PC connection

Parameters:
processor (int): The id of the processor to connect channel (int): The midi channel to use for the connection port (int): The midi port to use for the connection
get_all_cc_input_connections() → List[elkpy.sushi_info_types.MidiCCConnection][source]

Gets a list of all MIDI CC input connections in Sushi

Returns:
List[info_types.MidiCCConnection]: List of MidiCCConnection objects
get_all_kbd_input_connections() → List[elkpy.sushi_info_types.MidiKbdConnection][source]

Gets a list of all MIDI Keyboard input Connections in Sushi

Returns:
List[info_types.MidiKbdConnection]: List of MidiKbdConnection objects
get_all_kbd_output_connections() → List[elkpy.sushi_info_types.MidiKbdConnection][source]

Gets a list of all MIDI Keyboard output Connections in Sushi

Returns:
List[info_types.MidiKbdConnection]: List of MidiKbdConnection objects
get_all_pc_input_connections() → List[elkpy.sushi_info_types.MidiPCConnection][source]

Gets a list of all MIDI PC input connections in Sushi

Returns:
List[info_types.MidiPCConnection]: List of MidiPCConnection objects
get_cc_input_connections_for_processor(processor_id: int) → List[elkpy.sushi_info_types.MidiCCConnection][source]

Gets a list of all MIDI CC connection for a processor.

Parameters:
processor_id (int): The id of the processor to get the input connections from
Returns:
List[info_types.MidiCCConnection]: List of MidiCCConnection objects
get_input_ports() → int[source]

Gets MIDI input ports.

Returns:
int: IDs of the MIDI input ports
get_output_ports() → int[source]

Gets MIDI output ports.

Returns:
int: IDs of the MIDI output ports
get_pc_input_connections_for_processor(processor_id: int) → List[elkpy.sushi_info_types.MidiPCConnection][source]

Gets a list of all MIDI PC connection for a processor.

Parameters:
processor_id (int): The id of the processor to get the input connections from
Returns:
List[info_types.MidiPCConnection]: List of MidiPCConnection objects