jdxi_editor.ui.windows.midi.helpers.sysex_decode
Turns a line of hex into the byte list the debugger decodes, and decodes JD-Xi parameter dumps of any length: a 15-byte message sets one parameter, a longer one (a DT1 bulk dump, as the JD-Xi sends in reply to a data request) carries a whole parameter block.
Lines copied from the log file are accepted as they are: the log prints the
message without its F0/F7 frame and follows it with the parsed dictionary, so
parse_hex_line() stops at the first token that is not a hex byte and
frame_sysex() restores F0/F7.
Example
>>> parse_hex_line("41 10 00 00 00 0E 12 19 01 50 00 07 {'SYNTH_TONE': 'MODIFY'}")
[65, 16, 0, 0, 0, 14, 18, 25, 1, 80, 0, 7]
>>> frame_sysex([0x41, 0x10])
[240, 65, 16, 247]
>>> roland_checksum([0x19, 0x01, 0x50, 0x00, 0x07, 0x0B])
4
Attributes
Functions
|
Leading hex bytes of |
|
|
|
Roland checksum: the value that makes address + data + checksum a multiple of 128. |
|
Whether a framed |
|
|
|
|
|
|
|
Table of the header and every parameter in a framed JD-Xi parameter dump. |
Module Contents
- jdxi_editor.ui.windows.midi.helpers.sysex_decode.parse_hex_line(line: str) list[int][source]
Leading hex bytes of
line, stopping at the first token that is not one.- Parameters:
line – str e.g.
"F0 41 10 ..."or a log line"41 10 ... 04 {...}"- Returns:
list[int] byte values
- Raises:
ValueError – if the line does not start with a hex byte
- jdxi_editor.ui.windows.midi.helpers.sysex_decode.frame_sysex(message: list[int]) list[int][source]
messagewith its F0 and F7, adding whichever is missing.- Parameters:
message – list[int] SysEx bytes, framed or not
- Returns:
list[int] framed message
- jdxi_editor.ui.windows.midi.helpers.sysex_decode.roland_checksum(address_and_data: Iterable[int]) int[source]
Roland checksum: the value that makes address + data + checksum a multiple of 128.
- Parameters:
address_and_data – Iterable[int] address and data bytes
- Returns:
int checksum 0-127
- jdxi_editor.ui.windows.midi.helpers.sysex_decode.is_roland_dump(message: list[int]) bool[source]
Whether a framed
messageis a Roland address message longer than one parameter.- Parameters:
message – list[int] framed SysEx bytes
- Returns:
bool
- jdxi_editor.ui.windows.midi.helpers.sysex_decode.decode_parameter_dump(message: list[int]) str[source]
Table of the header and every parameter in a framed JD-Xi parameter dump.
Data bytes no parameter covers are listed as reserved when they are not 0, and counted otherwise, so a mostly empty block stays readable.
- Parameters:
message – list[int] framed SysEx bytes (F0 41 … checksum F7)
- Returns:
str text table