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.

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 MIDI Control Change messages 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): Whether the parameter changes relative to a previous value

connect_kbd_input_to_track(track: int, channel: int, port: int, raw_midi: bool) None[source]#

Connects MIDI Keyboard messages 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 MIDI Keyboard messages from a track to a MIDI output port

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 MIDI Program Change messages 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 Control Change connections from a 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 Program Change connections from a 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 Control Change 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): Whether the parameter changes relative 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 Program Change 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[MidiCCConnection][source]#

Gets a list of all MIDI Control Change input connections in Sushi

Returns:

List[info_types.MidiCCConnection]: List of MidiCCConnection objects

get_all_kbd_input_connections() List[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[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[MidiPCConnection][source]#

Gets a list of all MIDI Program Change input connections in Sushi

Returns:

List[info_types.MidiPCConnection]: List of MidiPCConnection objects

get_cc_input_connections_for_processor(processor_id: int) List[MidiCCConnection][source]#

Gets a list of all MIDI Control Change 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 the number of MIDI input ports.

Returns:

int: The number of MIDI input ports enabled in Sushi

get_midi_clock_output_enabled(port: int) bool[source]#

Gets whether MIDI clock output is enabled for a midi port.

Parameters:

port (int): The id of the processor to query

Returns:

bool: true if midi clock is enabled for that midi output port

get_output_ports() int[source]#

Gets the number of MIDI output ports.

Returns:

int: The number of MIDI output ports enabled in Sushi

get_pc_input_connections_for_processor(processor_id: int) List[MidiPCConnection][source]#

Gets a list of all MIDI Program Change 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

set_midi_clock_output_enabled(port: int, enabled: bool) None[source]#

Enable or disable MIDI clock output for a midi port.

Parameters:

port (int): The id of the output port to toggle enabled (bool): True to turn on clock output, False to turn off