Replaying captures
How to develop and test without a pedal: replay recorded sessions through the real engine, or read capture logs directly. The repository's logs of the official app talking to the pedal are also the library's test vectors.
Capture logs
A capture log is a text file of every MIDI message between a host and the pedal (Capturing traffic explains how they were recorded and how to record more).
<unix ms> <TX|RX> <len> [<port>] <hex…>
# MARK <ms> <text>TXis host → pedal (Origin::Host),RXpedal → host (Origin::Pedal).# MARKlines are annotations written while recording, e.g.DEVICE: AMP menu - stepping models + knobs.- Other lines (comments starting with
#,INFOlines) are skipped;MONlines count as pedal → host.
Logs in a checkout, under captures/logs/:
| Log | Contents |
|---|---|
00-selftest-identity.log | A five-line self-test of the sniffer: a universal identity request and the pedal's reply |
01-main-session.log | A 2-hour session: every module, looper, drum and settings driven from the pedal and from the official app, a preset save as, NAM imports and an IR import, annotated with # MARKs |
02-ir-tests.log | The official app importing ten designed test IRs into all ten IR slots |
Replay through the engine
replay(path, speed) plays a log through the engine, emitting the same Updates as a live pedal. Your program can't tell the difference, so a front end can be built with no pedal attached.
use open_stomp::device::{Config, Device, Update};
let dev = Device::spawn(Config { auto_connect: false, ..Config::default() });
dev.replay("captures/logs/01-main-session.log", 8.0);
while let Ok(update) = dev.recv() {
match update {
Update::Info { text, .. } if text == "Replay finished" => break,
// apply Update::Message to a DeviceState as usual
_ => {}
}
}from open_stomp import Device, DeviceState
state = DeviceState()
with Device(auto_connect=False) as dev:
dev.replay("captures/logs/01-main-session.log", 8.0) # speed defaults to 4.0
for u in dev:
if ev := state.feed(u):
print(ev)
if u.kind == "info" and u.text == "Replay finished":
break- Timing: the log's original timing, with gaps capped at 1.5 s, divided by
speed. - Start: the engine disconnects from any pedal and turns auto-connect off, then sends
Update::ResetandStatus::Replaying { file, progress }. - During:
Messageupdates with the original direction (Origin::Hostis the official app),Markupdates for annotations, andReplayingprogress every 25 entries.atis the original capture time. - End:
Replayingwith progress 1.0, thenInfo"Replay finished". - Stop early:
stop_replay();connect(port)also stops it. - No sending: there is no pedal, so live edits are refused during a replay.
Read a log directly
capture::parse(text) reads a whole log into complete messages (split SysEx reassembled), with no engine and no timing.
use open_stomp::capture::{self, Entry};
use open_stomp::DeviceState;
let text = std::fs::read_to_string("captures/logs/01-main-session.log")?;
let mut state = DeviceState::default();
for e in capture::parse(&text) {
match e {
Entry::Mark { text, .. } => println!("===== {text}"),
Entry::Message { origin, bytes, .. } => {
let ev = state.apply(&bytes, origin);
println!("{:8} {} = {}", ev.category.label(), ev.subject, ev.value);
}
}
}from open_stomp import DeviceState, capture
state = DeviceState()
for e in capture.parse(open("captures/logs/01-main-session.log").read()):
if e.kind == "mark":
print("=====", e.text)
else:
print(state.apply(e.bytes, e.origin))Entry::Message { ms, origin, bytes } and Entry::Mark { ms, text } carry the Unix time in milliseconds. In Python, Entry.kind is "message" or "mark".
Ready-made tools
cargo run --example monitor -- --replay captures/logs/01-main-session.log --speed 8
cargo run --example decode -- captures/logs/01-main-session.log # instant, no engine
python bindings/python/examples/monitor.py --replay captures/logs/01-main-session.log --speed 8
python bindings/python/examples/shell.py --replay captures/logs/01-main-session.logmonitor(Rust and Python) prints every event;--allincludes protocol plumbing and repeats.decodeprints a log as readable events at once;--allas above.shell.pygives the interactive shell over a replayed session.- Python decoders in the open-stomp-manager repository (
tools/decode/live.py,analyze.py) do the same with more detail.
Tests
The capture logs drive the library's tests, so the protocol code is checked against real traffic.
cargo test # unit tests + the capture-driven tests
cargo test --no-default-features # protocol only
cargo clippy --all-targets -- -D warnings| Test | Checks |
|---|---|
capture::tests::replay_main_session | The whole 2 h session applies cleanly: firmware, product, 99 named presets, settings |
capture::tests::records_round_trip | Every preset and settings record on the wire re-encodes byte for byte; parameter counts agree with the catalogue |
capture::tests::save_as_matches_capture | The captured save as is rebuilt from state alone |
capture::tests::preset_switch_applies_cached_preset | Program changes load the cached preset into the edit buffer |
tests/offline_pedal.rs | The full startup sync through RequestQueue against a fake pedal answering with the captured replies |
tests/device_replay.rs | The engine thread end to end via replay, including shutdown on drop |
tests/ir_import.rs | The IR conversion against captured imports |
tests/nam_convert.rs, tests/nam_inference.rs | The NAM converter and inference against reference data |
queue::tests | Pacing, timeouts, settings coalescing, follow-up reads |
midi::tests, records::tests, pack::tests, catalog::tests | Builders and codecs against captured bytes |
The Python tests are listed under Python API; the full checklist is in CONTRIBUTING.md.
Not done yet
A virtual ALSA port (snd-virmidi) plus a small fake pedal answering from the captures would test the MIDI I/O path itself offline.
