jdxi_editor.midi.io.synth_memory ================================ .. py:module:: jdxi_editor.midi.io.synth_memory .. autoapi-nested-parse:: jdxi_editor.midi.io.synth_memory What the editor knows of the JD-Xi's parameter memory, byte by byte. Every DT1 (data set) that passes through the MIDI helper is recorded: replies from the JD-Xi and the parameter changes the editor sends. A patch can then be saved as the synth's own bytes, i.e. raw MIDI values, rather than from the editor's controls, whose display units (ms, fractions, ±63) differ per widget and lose precision. Roland addresses and sizes are 7-bit per byte; they are kept as linear offsets so a section can cross a byte boundary (Effect 1 is 145 bytes from 18 00 02 00, ending at 18 00 03 10). .. rubric:: Example >>> memory = SynthMemory() >>> memory.record_dt1(bytes.fromhex("F0 41 10 00 00 00 0E 12 19 42 00 00 01 02 22 F7")) True >>> memory.read(bytes.fromhex("19 42 00 00"), 2) b'\x01\x02' >>> memory.read(bytes.fromhex("19 42 00 00"), 3) is None # third byte unknown True Attributes ---------- .. autoapisummary:: jdxi_editor.midi.io.synth_memory.JDXI_DT1_HEADER jdxi_editor.midi.io.synth_memory.SYSEX_END Classes ------- .. autoapisummary:: jdxi_editor.midi.io.synth_memory.SynthMemory Functions --------- .. autoapisummary:: jdxi_editor.midi.io.synth_memory.address_to_linear jdxi_editor.midi.io.synth_memory.linear_to_address jdxi_editor.midi.io.synth_memory.roland_checksum jdxi_editor.midi.io.synth_memory.build_dt1 Module Contents --------------- .. py:data:: JDXI_DT1_HEADER .. py:data:: SYSEX_END :value: 247 .. py:function:: address_to_linear(address: Sequence[int]) -> int 4 bytes of 7 bits -> linear offset. .. py:function:: linear_to_address(value: int) -> bytes Linear offset -> 4 bytes of 7 bits. .. py:function:: roland_checksum(data: Sequence[int]) -> int .. py:function:: build_dt1(address: Sequence[int], data: Sequence[int]) -> bytes A JD-Xi DT1 message writing *data* at *address*. .. py:class:: SynthMemory Thread-safe byte map of the JD-Xi's memory, filled from DT1 messages. .. py:attribute:: SECTION_MIN_BYTES :value: 8 .. py:attribute:: _bytes :type: dict[int, int] .. py:attribute:: _sections :type: dict[int, int] .. py:attribute:: _lock .. py:method:: record_dt1(message: Sequence[int]) -> bool Record a DT1 message (with or without F0/F7); returns False if it is not one. Layout without F0: 41, device, model×4, 12, address×4, data…, checksum[, F7] .. py:method:: sections() -> list[tuple[bytes, int]] (address, size) of every section seen as a whole, in address order. .. py:method:: read(address: Sequence[int], size: int) -> Optional[bytes] The *size* bytes from *address*, or None if any of them is unknown. .. py:method:: section_dt1(address: Sequence[int], size: int) -> Optional[bytes] The section as one DT1 message, as the JD-Xi would send it, or None. .. py:method:: clear() -> None .. py:method:: forget(ranges: Sequence[tuple[int, int]]) -> None Forget the bytes (and sections) in linear [start, end) *ranges*.