Rust integration
Integrate the DSP-only in-memory engine or the complete native Sidespread pipeline.
Sidespread exposes a portable in-memory engine and the native file pipeline from the same crate. Choose features according to whether your application needs the CLI, WAV I/O, or UniverSR.
DSP-only dependency
TOML[dependencies]sidespread = { git = "https://github.com/backrunner/sidespread", default-features = false}
Disabling default features leaves the analysis and non-neural repair modules available without ONNX Runtime, model downloads, terminal UI, or filesystem audio I/O.
Process interleaved audio
Rustuse sidespread::engine::{process_interleaved, ProcessOptions};fn repair(samples: &[f32], sample_rate: u32) -> anyhow::Result<Vec<f32>> { let options = ProcessOptions { dsp_strength: 1.6, bandwidth_extension: true, ..ProcessOptions::default() }; let result = process_interleaved(samples, sample_rate, &options)?; eprintln!("processed: {}", result.report.processed); Ok(result.audio)}
The slice must contain interleaved stereo f32 samples. The returned vector has the same channel layout and frame count.
Observe processing progress
Rustuse sidespread::engine::{process_interleaved_with_progress, ProcessOptions};let result = process_interleaved_with_progress( &samples, 48_000, &ProcessOptions::default(), |event| eprintln!("{:?}: {:.0}%", event.stage, event.progress * 100.0),)?;
The callback runs after each high-level stage begins and finishes with ProcessStage::Complete at
1.0. Use the original process_interleaved function when progress is not needed.
Analyze without processing
Rustuse sidespread::engine::{analyze_interleaved, ProcessOptions};let report = analyze_interleaved(&samples, 44_100, &ProcessOptions::default())?;if report.needs_processing { println!("{} routed windows", report.missing_band.routed_segments);}
Native pipeline
Default features include the CLI, WAV I/O, terminal progress, model management, and optional neural routes:
TOML[dependencies]sidespread = { git = "https://github.com/backrunner/sidespread" }
Rustuse sidespread::{config::Config, pipeline};let config = Config::from_process(8_000, 0.3);pipeline::process("input.wav", "output.wav", &config, None)?;
The native pipeline preserves the CLI behavior: it does not write a WAV when no stage is accepted.
Continue with the Rust API reference.