Skip to content

Rust quick start ​

Add the open-stomp crate to a Rust project and run a first program against the pedal. For Python, see the Python quick start.

Requirements ​

  • Rust: 1.88 or newer.
  • macOS and Windows: nothing else.
  • Linux: the ALSA headers for the device feature and the D-Bus headers for ble (Bluetooth also needs BlueZ at run time).
SystemCommand
Debian, Ubuntusudo apt install libasound2-dev libdbus-1-dev
Fedorasudo dnf install alsa-lib-devel dbus-devel
Nix, in a checkoutnix develop (cargo, rust-analyzer, ALSA, D-Bus, amidi)

The pedal is class compliant, so no driver is needed on any system.

Add the dependency ​

The crate isn't on crates.io yet. Add it from GitHub, pinned to a release tag:

toml
[dependencies]
open-stomp = { git = "https://github.com/JackMechem/open-stomp-lib", tag = "v0.7.0" }

Other ways to point at it:

FormGives you
tag = "v0.7.0"Exactly that release (recommended)
branch = "stable"The newest release; cargo update moves you forward
branch = "unstable"The newest release or pre-release (vX.Y.Z-beta.N tags)
path = "../open-stomp-lib"A local checkout next to your project
default-features = falseThe protocol layer alone: no MIDI I/O, no dependencies (feature flags)

First program ​

This connects to the pedal, waits for the startup sync, turns the active preset's amp gain up, then prints everything that happens.

rust
use open_stomp::device::{Config, Device, Update};
use open_stomp::{DeviceState, Module};

fn main() {
    let dev = Device::spawn(Config::default()); // finds and connects to the pedal by itself
    let mut state = DeviceState::default();
    let mut synced = false;

    while let Ok(update) = dev.recv() {
        match update {
            Update::Reset => {
                state = DeviceState::default(); // new connection: start over
                synced = false;
            }
            Update::Sync { total: 0, .. } if !synced && state.firmware.is_some() => {
                synced = true;
                // live edits: heard at once, stored only when you save
                dev.set_head(Module::Amp, 8, true); // AMP on, model 8 (Mar J800)
                dev.set_param(Module::Amp, 0, 100); // GAIN = 100
            }
            Update::Message { origin, bytes, .. } => {
                let ev = state.apply(&bytes, origin);
                println!("{:8} {} = {}", ev.category.label(), ev.subject, ev.value);
            }
            Update::Info { text, .. } => eprintln!("{text}"),
            _ => {}
        }
    }
}

Run it with the pedal plugged in:

sh
cargo run

Send after the sync

The engine refuses edits until it is connected (you get an Update::Info with error: true). Waiting for the end of the startup sync, as above, also means state knows the pedal's presets.

Import a NAM model and a cab IR ​

Slots are 0–9 (USER AMP 01–10, USER IR 01–10). An import overwrites what is in the slot.

rust
// inside the `synced` branch above; main() returns
// Result<(), Box<dyn std::error::Error + Send + Sync>>
dev.import_nam_file(9, "Ampeg SVT.nam")?; // optimised conversion, about a minute
dev.import_ir_file(9, "Ampeg 8x10.wav")?; // optimised conversion, under a second

Build with --release for imports: the NAM conversion takes about a minute in an optimised build. See User AMP and IR slots.

Without a pedal ​

A checkout of the repository includes capture logs of the official app talking to the pedal. The examples replay them through the real engine:

sh
git clone https://github.com/JackMechem/open-stomp-lib && cd open-stomp-lib
cargo run --example monitor -- --replay captures/logs/01-main-session.log --speed 8
cargo run --example decode -- captures/logs/01-main-session.log

With a pedal plugged in:

sh
cargo run --example monitor               # follow the pedal
cargo run --example monitor -- --listen   # never send anything
cargo run --example ports                 # list MIDI ports, marking the pedal's

Next ​

MIT or Apache-2.0. Not affiliated with SORAN.