Presets and settings
How to store presets on the pedal, rename them, and change the global settings, plus the Preset and Settings records the library uses for them. The byte layouts are on the Preset record and Other records pages.
Back up first
Writes overwrite the pedal
save_preset and write_settings overwrite what is stored on the pedal. They match the official app byte for byte but haven't been run on hardware from this library yet, so keep your presets before you experiment.
- Back up: after the sync, every stored preset is in
state.presets; keep thosePresets (or theirto_raw()bytes). The Python exampleshell.pyhasbackup FILE, which writes every read preset and the settings to a JSON file. - Restore: write a kept
Presetback withsave_preset. - Never send anything:
Config { sync: false, .. }(Device(sync=False)) guarantees no byte goes to the pedal.
Save a preset
Take the live sound (the edit buffer, with all your live edits), give it a slot and a name, and save it.
let mut p = state.live.clone(); // the edit buffer, with all live edits applied
let source = state.current.unwrap(); // the slot the edits were made on
p.index = 21; // store to P22 (or keep `source` to overwrite)
p.name = "Lead".into(); // ≤ 16 printable ASCII; others become '?'
dev.save_preset(source, &p);p = state.live # a copy of the edit buffer with all live edits
source = state.current # the slot the edits were made on
p.index = 21 # store to P22 (or keep `source` to overwrite)
p.name = "Lead" # <= 16 printable ASCII; others become '?'
dev.save_preset(source, p) # name, record, then select the saved slotsave_preset(source_slot, &preset) queues the official app's exact sequence (Commands):
- A
0x12name write. Its first byte issource_slot, the active preset the edits were made on (the official app sends it even when saving to another slot). - A
0x0Bpreset write to slotpreset.index, which waits for its ack. - A program change to the saved slot.
The sequence is tested byte for byte against a captured save as from the official app.
Rename a preset
A rename is a save with a new name to the same slot:
let i = state.current.unwrap();
let mut p = state.live.clone();
p.name = "Clean Verb".into();
dev.save_preset(i, &p); // p.index is already ii = state.current
p = state.live
p.name = "Clean Verb"
dev.save_preset(i, p)- Names: up to 16 characters; non-ASCII becomes
?. - Name only:
host::preset_name(source_slot, name)sets just the edit buffer's name. Store it with a save.
Read-modify-write
Never build a record from scratch: several bytes of the preset and settings records are still unknown.
- Start from a record the pedal sent:
state.live,state.stored(i)orstate.settings. - Change only the fields you understand.
- Write it back with
save_presetorwrite_settings. The encoder keeps every other byte as it was.
The official app does the same for the system settings.
The Preset record
Preset decodes the 110-byte record of a 0x0B (preset) or 0x0C (edit buffer) body.
| Field | Record bytes | Meaning |
|---|---|---|
index | 0 | 0-based slot. Always 0 in the edit buffer; DeviceState fixes it up |
modules[8] | heads 12–19, params per module | One ModuleState per effect module, indexed by Module::index() |
volume | 78 | Preset volume, 0–100 |
chain[8] | 82–89 | Module indices of all eight effect blocks in signal order, GATE included (signal chain) |
name | 94–109 | Up to 16 ASCII characters |
raw | all 110 | The record as read; unknown bytes survive a round trip |
Changed in 0.7.0
Preset::chain is now all eight effect modules, GATE included ([u8; 8], bytes 82–89); before, byte 82 was taken for a constant and chain had seven entries. In Python, Preset.chain is a list of eight Modules and now includes Module.GATE.
ModuleState field | Meaning |
|---|---|
on | Block on or off |
model | 0-based model index |
params[12] | Parameter values by slot (only the module's first N are used) |
head() / set_head(b) | The head byte: bit 6 set = off, low 6 bits = model |
Methods
| Rust | Python | Does |
|---|---|---|
Preset::from_packed(body) | Preset.from_packed(body) | Decode a packed 0x0B/0x0C body. Rust: None if it isn't one; Python: ValueError |
Preset::from_raw(bytes) | Preset.from_raw(bytes) | Decode the unpacked 110 bytes |
to_raw() | to_raw() | The 110-byte record: raw with every decoded field written back |
to_packed() | to_packed() | The packed body for a 0x0B write |
module(m) / module_mut(m) | module(m) | One module's state (Python: a copy) |
set_module(m, on=…, model=…, params=…), set_param(m, slot, value) | Edit a module (Python) | |
same_sound(&other) | same_sound(other) | Same modules, volume and chain, ignoring unused parameter slots |
Preset::default() | Preset() | An empty preset |
clone() | copy(), copy.copy, copy.deepcopy | A copy |
- Unknown bytes: the decoder keeps the full record in
rawand the encoder writes only known fields back over it, so bytes that are still unknown round-trip untouched (open questions). Always start from a record the pedal sent. - Param counts: when a module's model changes, its parameter-count byte is recomputed (
records::param_count; CAB always carries all five). - Constants:
PRESET_COUNT(99),PRESET_LEN(110),CHAIN_LEN(8),DEFAULT_CHAIN,records::valid_chain(order). - Python: assigning a whole list to
p.modulesalso works.
Settings
The global settings are written whole. Always start from the record the pedal sent, so unknown bytes survive.
let mut s = state.settings.clone().expect("synced");
s.input_trim = 13; // 0–20 = −10…+10 dB
s.loopback = false;
dev.write_settings(&s);s = state.settings # a copy of the pedal's record
s.input_trim = 13 # 0-20 = -10..+10 dB
s.loopback = False
dev.write_settings(s)Settings field | Meaning |
|---|---|
input_trim | 0–20 = −10…+10 dB; input_trim_db() gives the dB value (a property in Python) |
eq_bass, eq_mid, eq_treble | Global EQ, 0–100 (50 = centre). Changes made on the pedal aren't reported over USB |
wireless | The Wireless (Bluetooth) setting |
loopback | The LoopBack setting |
raw | The 17-byte record as read |
- Encoding:
Settings::from_packed(body)decodes a0x14body andto_packed()encodes it; values are clamped to their ranges on write. - Sliders: successive settings writes still waiting in the queue collapse into the latest one, so a slider can write on every change.
- Python:
Settingshascopy()too, but no constructor; get one fromstate.settingsorSettings.from_packed.
