Testing and evaluation — what CI checks and how we judge the sound
CI (every push and pull request)
Runs in nix develop .#pure (Toolchain) with a binary cache (Cachix) so the toolchain isn’t rebuilt each time.
Status (Dec 2026)
.github/workflows/ci.ymlruns the Rust gates (withcargo testinstead of nextest) and the Julia gates (Julia 1.13) on GitHub Actions, without Nix: rustup installs the toolchain fromrust-toolchain.toml, and baseview loads X11/GL at runtime, so no system packages are needed. Golden vectors,clap-validator, the GUI smoke test,cargo denyand the Nix/Cachix setup are still to come (T-021).
| Gate | What |
|---|---|
| Rust | cargo fmt --check, cargo clippy --all-targets -- -D warnings, cargo nextest run |
| Julia | Pkg.test() in training/ |
| Golden vectors | Rust output against every model’s golden.safetensors (Piano model file) |
| Plugin | clap-validator on every built plugin |
| Licences | cargo deny check |
Plugin tests
- In-process host (
crates/piano/tests/host.rs, with clack-host): descriptor and ports, a note sounds, the gain parameter follows host automation (-40 dB), released notes decay, state saves and loads and rejects unknown versions. Part ofcargo nextest run. - GUI smoke test on X11 (
crates/piano/tests/gui_x11.rs, ignored by default): opens the editor as a host would (createembedded X11 →set_parentwith an X11 window we own →show), checks it became a child window and drew (pixel read-back;GUI_SMOKE_PPM=<file>saves the image), that a pointer press on a drawn key plays the plugin (T-046), and thatdestroyremoves it. Run withnix develop .#gui-test -c scripts/gui-smoke-test.sh. It does not replace trying the plugin in a real DAW. - clap-validator on the release bundle:
cargo xtask bundle piano --release && clap-validator validate "target/bundled/Instruments Piano.clap".
Unit and property tests in Rust
- Resonator precision: a 27.5 Hz partial with a 20 s T60, at 44.1/48/96 kHz: frequency within 0.1 cent, decay within 1 % after 20 s (Piano 13).
- Block-size independence: identical output for block sizes 1, 64, 513 and varying sizes.
- Sample-rate consistency: partial frequencies and decays agree at 44.1, 48, 96 kHz.
- No allocation in
process:assert_no_allocin debug test builds. - Restrike: a repeated note continues from the vibrating state (not reset).
- Model validation: malformed model files are refused.
Benchmarks
criterion benchmarks of the engine: one key, the full keyboard, a dense pedalled MIDI excerpt — in real-time factor per core. Run in CI and reported, not gated (shared runners are noisy); compared on a fixed machine before merging performance work.
Objective evaluation of the sound
On held-out recordings (keys and velocities not used for fitting):
- multi-resolution STFT log-magnitude distance on the first 1–2 s;
- partial frequency error (cents) and decay-rate error per partial;
- spectral centroid against velocity, compared with the recordings;
- for performances (MAESTRO, research only per ADR-0007): spectrogram distance of MIDI renders against the audio.
Listening tests
Numbers don’t decide whether it sounds like a piano. Two small, documented protocols:
- ABX discrimination: recording vs model for isolated notes (loudness-matched, same length). If listeners can’t tell above chance, that note range is done.
- MUSHRA-style rating (0–100) of short excerpts: hidden reference recording, model versions, and a low anchor (e.g. a plain harmonic additive synth) — to compare model stages and track progress.
Results (listeners, setup, scores) go into a page per test run, linked from here.