jdxi_editor.midi.io.helper
This module provides address unified helper class for MIDI communication with the Roland JD-Xi. It integrates both MIDI input and output functionalities by combining the features of the MIDIInHandler and MIDIOutHandler classes.
- Classes:
- MIDIHelper: A helper class that inherits from both MIDIInHandler and MIDIOutHandler,
offering address consolidated interface for handling MIDI messages (including SysEx messages in JSON format) for the JD-Xi synthesizer.
- Dependencies:
PySide6.QtCore.Signal for Qt signal support.
jdxi_editor.midi.input_handler.MIDIInHandler for handling incoming MIDI messages.
jdxi_editor.midi.output_handler.MIDIOutHandler for handling outgoing MIDI messages.
Classes
Expected wire info registered before a combo-driven Load send. |
|
MidiIOHelper |
Functions
|
Name stored in a patch JSON section, or "". |
Module Contents
- jdxi_editor.midi.io.helper.patch_json_tone_name(data: dict) str[source]
Name stored in a patch JSON section, or “”.
Parsed replies carry TONE_NAME as text; saved patches carry the 12 character codes TONE_NAME_1..TONE_NAME_12.
- class jdxi_editor.midi.io.helper.MidiSelectionExpectation[source]
Expected wire info registered before a combo-driven Load send.
- class jdxi_editor.midi.io.helper.MidiIOHelper(parent=None)[source]
Bases:
jdxi_editor.midi.io.input_handler.MidiInHandler,jdxi_editor.midi.io.output_handler.MidiOutHandlerMidiIOHelper
Class to handle midi input/output
- _selection_expectation: MidiSelectionExpectation | None = None[source]
- set_selection_expectation(expected: Any, source: str, selection_value: Any = None) None[source]
Register expected wire info for the next bank-select + PC send.
- clear_selection_expectation() None[source]
Clear registered expectation (e.g. when combo selection changes).
- get_selection_expectation() MidiSelectionExpectation | None[source]
Return the current selection expectation, if any.
- send_mido_message(msg: mido.Message)[source]
send_mido_message
- Parameters:
msg – mido.Message
- Returns:
- send_json_patch_to_instrument(json_string: str) None[source]
Send all parameters from a JSON patch to the instrument as SysEx messages.
- Parameters:
json_string – str JSON string containing patch data
- Returns:
None
- json_patch_to_sysex_bytes(json_string: str) list[bytes][source]
Convert a JSON patch to a list of SysEx message bytes (for export to .syx). Uses the same param resolution and composition logic as send_json_patch_to_instrument.
- Parameters:
json_string – str JSON string containing patch data
- Returns:
list[bytes] List of SysEx message bytes, one per parameter
- save_patch_as_syx(file_path: str, temp_folder) bool[source]
Save patch as raw Roland SysEx (.syx) from JSON files in temp folder. Reads each JSON file, converts to SysEx bytes, concatenates, and writes.
- Parameters:
file_path – str Output .syx file path
temp_folder – Path-like Folder containing JSON patch files (from json_composer.process_editor)
- Returns:
bool True on success
- load_patch(file_path: str)[source]
Load the patch file and send to the instrument. Handles .jsz/.msz (JSON bundles), .json, and .syx (binary SysEx). .msz bundles may contain MIDI files (handled by PatchManager).
- Parameters:
file_path – str
- Returns:
None
- _load_patch_section(json_string: str) None[source]
Load one section of a patch file: show it in the editors and titles, and send it to the instrument.
A section with SYSEX (saved from the synth’s memory) is sent as that DT1 and shown as the JD-Xi would report it. An older section, saved in display units, is converted to raw MIDI values first.
- _emit_patch_json(json_string: str, data: dict) None[source]
Show one loaded section in the editors and titles.
The editors apply it without writing it back (the section is sent to the instrument separately), and a Common section’s name updates the program / tone titles the same way a reply from the JD-Xi does.
- Parameters:
json_string – section JSON for the editors
data – the section as saved (4-byte ADDRESS)
- load_sysx_patch(file_path: str)[source]
Load the SysEx patch from a file and send to the instrument. Supports single messages and concatenated messages (e.g. Perl .syx format). Each F0…F7 block is sent as a separate message.
- Parameters:
file_path – str File path as a string
- Returns:
None
- set_midi_ports(in_port: str, out_port: str) bool[source]
Open the ports that were asked for.
Either name may be empty, and then that direction is simply not opened. A SoundFont is an output with no input of its own, and a machine may offer no MIDI input at all; refusing the output because there was no input to go with it left the MIDI Player, the keyboard and every editor sending into a closed port, while a FluidSynth test note – which does not go through MIDI – was still heard.
When both were asked for, they still stand or fall together: half a connection to a JD-Xi shows as connected and reads as a dead one.
- Parameters:
in_port – str, or empty for no input
out_port – str, or empty for no output
- Returns:
bool True when everything asked for is open
- _close_quietly(name: str) None[source]
Close the port held in name (midi_in / midi_out) if it is open.
- connect_port_names(in_port: str, out_port: str) bool[source]
Attempt to automatically connect to JD-Xi MIDI ports.
- Parameters:
in_port – str
out_port – str
- Returns:
bool True on success, False otherwise