Skip to content

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).

text
<unix ms> <TX|RX> <len> [<port>] <hex…>
# MARK <ms> <text>
  • TX is host → pedal (Origin::Host), RX pedal → host (Origin::Pedal).
  • # MARK lines are annotations written while recording, e.g. DEVICE: AMP menu - stepping models + knobs.
  • Other lines (comments starting with #, INFO lines) are skipped; MON lines count as pedal → host.

Logs in a checkout, under captures/logs/:

LogContents
00-selftest-identity.logA five-line self-test of the sniffer: a universal identity request and the pedal's reply
01-main-session.logA 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.logThe 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.

rust
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
        _ => {}
    }
}
python
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::Reset and Status::Replaying { file, progress }.
  • During: Message updates with the original direction (Origin::Host is the official app), Mark updates for annotations, and Replaying progress every 25 entries. at is the original capture time.
  • End: Replaying with progress 1.0, then Info "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.

rust
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);
        }
    }
}
python
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 ​

sh
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.log
  • monitor (Rust and Python) prints every event; --all includes protocol plumbing and repeats.
  • decode prints a log as readable events at once; --all as above.
  • shell.py gives 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.

sh
cargo test                       # unit tests + the capture-driven tests
cargo test --no-default-features # protocol only
cargo clippy --all-targets -- -D warnings
TestChecks
capture::tests::replay_main_sessionThe whole 2 h session applies cleanly: firmware, product, 99 named presets, settings
capture::tests::records_round_tripEvery preset and settings record on the wire re-encodes byte for byte; parameter counts agree with the catalogue
capture::tests::save_as_matches_captureThe captured save as is rebuilt from state alone
capture::tests::preset_switch_applies_cached_presetProgram changes load the cached preset into the edit buffer
tests/offline_pedal.rsThe full startup sync through RequestQueue against a fake pedal answering with the captured replies
tests/device_replay.rsThe engine thread end to end via replay, including shutdown on drop
tests/ir_import.rsThe IR conversion against captured imports
tests/nam_convert.rs, tests/nam_inference.rsThe NAM converter and inference against reference data
queue::testsPacing, timeouts, settings coalescing, follow-up reads
midi::tests, records::tests, pack::tests, catalog::testsBuilders 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.

MIT or Apache-2.0. Not affiliated with SORAN.