Skip to content

Features

Rodrigo Agurto edited this page May 30, 2026 · 1 revision

Cargo Features

All features are off by default. Pick what you need at your dep declaration.

Render / export

Feature Adds Notes
png dep:resvg Pure Rust, no system libs. Adds ~200 KB compiled.
pdf dep:svg2pdf, dep:resvg, dep:pdf-writer Single + multi-page PDF assembly.
verovio = { version = "0.1", features = ["png", "pdf"] }

Audio

Feature Adds Notes
audio dep:rustysynth Offline PCM/WAV via SoundFont. Pure Rust. ~150 KB.
live-audio audio + dep:cpal Used by examples/live_playback.rs. Pulls cpal (alsa-lib on Linux).
verovio = { version = "0.1", features = ["audio"] }

The audio feature only handles offline rendering — you get a Vec<f32> PCM buffer or .wav bytes. The caller supplies SoundFont (SF2) bytes; the crate does not bundle one (typical SF2 sizes are 6–140 MB).

The live-audio feature exists so the example compiles when explicitly requested. Default cargo test runs do not pull cpal, so contributors on bare environments don't need alsa-lib installed.

Sanitizers

Feature Adds to the C++ build Mutually exclusive?
sanitize -fsanitize=address,undefined -fno-omit-frame-pointer with sanitize-thread
sanitize-thread -fsanitize=thread -fno-omit-frame-pointer with sanitize
RUSTFLAGS="-C linker=clang -C link-arg=-fuse-ld=lld" \
ASAN_OPTIONS="halt_on_error=1:abort_on_error=1:detect_leaks=0" \
    cargo test --features verovio/sanitize

build.rs panics if both sanitize and sanitize-thread are enabled at once (the libsanitizer runtimes can't coexist).

Only the C++ side is instrumented. Rust-side sanitizers require nightly Rust with -Zsanitizer=…; for the C++/Rust mutex visibility issue this implies for set_log_level, see Concurrency.

Feature combinations that matter

You want Features
Just SVG and MIDI (no features)
Bitmap export for thumbnails png
PDF export for print pdf
Both PNG and PDF png, pdf
Offline .wav for batch processing audio
Run the live playback demo live-audio (+ alsa-lib on Linux)
ASan-instrumented C++ tests sanitize
Race detection in the C++ tests sanitize-thread
Maximum surface png, pdf, audio

Clone this wiki locally