jdxi_editor.midi.io.output_handler

This module provides the MIDIOutHandler class for managing MIDI output, allowing users to send note-on, note-off, and control change messages through address specified MIDI output port.

Dependencies:
  • rtmidi: A library for working with MIDI messages and ports.

Example usage:

handler = MIDIOutHandler(“MIDI Output Port”) handler.send_note_on(60, velocity=100) handler.send_note_off(60) handler.send_control_change(7, 127) handler.close()

Classes

MidiOutHandler

Helper class for MIDI communication with the JD-Xi.

Module Contents

class jdxi_editor.midi.io.output_handler.MidiOutHandler(parent=None)[source]

Bases: jdxi_editor.midi.io.controller.MidiIOController

Helper class for MIDI communication with the JD-Xi.

midi_message_outgoing[source]
parent = None[source]
channel = 1[source]
sysex_parser[source]
_midi_send_lock[source]
send_raw_message(message: Iterable[int]) bool[source]

Thread-safe version of sending a raw MIDI message. Handles logging, validation, and exceptions safely.

send_note_on(note: int = 60, velocity: int = 127, channel: int = 1) None[source]

Send ‘Note On’ message to the specified MIDI channel.

Parameters:
  • note – int MIDI note number (0–127), default is 60 (Middle C).

  • velocity – int Note velocity (0–127), default is 127.

  • channel – int MIDI channel (1–16), default is 1.

send_note_off(note: int = 60, velocity: int = 0, channel: int = 1) None[source]

Send address ‘Note Off’ message

Parameters:
  • note – int MIDI note number (0–127), default is 60 (Middle C).

  • velocity – int Note velocity (0–127), default is 127.

  • channel – int MIDI channel (1–16), default is 1.

send_channel_message(status: int, data1: int | None = None, data2: int | None = None, channel: int = 1) None[source]

Send a MIDI Channel Message.

Parameters:
  • status – int Status byte (e.g., NOTE_ON, NOTE_OFF, CONTROL_CHANGE).

  • data1 – Optional[int]): First data byte, typically a note or controller number.

  • data2 – Optional[int]): Second data byte, typically velocity or value.

  • channel – int MIDI channel (1-based, range 1-16).

Raises:

ValueError If the channel is out of range (1-16).

send_bank_select(msb: int, lsb: int, channel: int = 0) bool[source]

Send address bank select message.

Parameters:
  • msb – int Upper byte of the bank.

  • lsb – int Lower byte of the bank.

  • channel – int midi channel (0-15).

Returns:

bool True if successful, False otherwise.

send_identity_request() bool[source]

Send identity request message (Universal System Exclusive).

Returns:

bool True if the message was sent successfully, False otherwise.

send_midi_message(sysex_message: jdxi_editor.midi.message.MidiMessage) bool[source]

Send SysEx parameter change message using a MidiMessage.

Parameters:

sysex_message – MidiMessage instance to be converted and sent.

Returns:

True if the message was successfully sent, False otherwise.

send_program_change(program: int, channel: int = 0) bool[source]

Send address program change message.

Parameters:
  • program – int Program number (0-127).

  • channel – int MIDI channel (0-15).

Returns:

True if successful, False otherwise.

send_control_change(controller: int, value: int, channel: int = 0) bool[source]

Send control change message.

Parameters:
  • controller – int Controller number (0–127).

  • value – int Controller value (0–127).

  • channel – int MIDI channel (0–15).

Returns:

bool True if successful, False otherwise.

send_rpn(parameter: int, value: int, channel: int = 0) bool[source]

Send a Registered Parameter Number (RPN) message via MIDI Control Change.

Parameters:
  • parameter – int RPN parameter number (0–16383).

  • value – int Parameter value (0–16383).

  • channel – int MIDI channel (0–15).

Returns:

True if messages sent successfully, False otherwise.

send_nrpn(parameter: int, value: int, channel: int = 0, use_14bit: bool = False) bool[source]

Send a Non-Registered Parameter Number (NRPN) message via MIDI Control Change.

Parameters:
  • parameter – int NRPN parameter number (0–16383).

  • value – int Parameter value (0–16383 for 14-bit, 0–127 for 7-bit).

  • channel – int MIDI channel (0–15).

  • use_14bit – bool If True, send both MSB and LSB for value (14-bit). If False, send only MSB (7-bit).

Returns:

True if all messages were sent successfully, False otherwise.

send_bank_select_and_program_change(channel: int, bank_msb: int, bank_lsb: int, program: int) bool[source]

Sends Bank Select and Program Change messages with delays between messages to ensure the synthesizer can process them correctly.

Parameters:
  • channel – int MIDI channel (1-16).

  • bank_msb – int Bank MSB value.

  • bank_lsb – int Bank LSB value.

  • program – int Program number.

Returns:

bool True if all messages are sent successfully, False otherwise.

identify_device() None[source]

Send Identity Request and verify response

Returns:

None

send_message(message: jdxi_editor.midi.message.MidiMessage) None[source]

unpack the message list and send it

Parameters:

message – MidiMessage

Returns:

None