Architecture

trail mix is a Rust workspace. It accepts an audio file or mono PCM and returns tempo, key, beat positions, and waveform data as versioned JSON. beat-salad, key-lime, and sampler-platter are independent crates that can be used on their own. trailmix is an optional facade that runs all three and returns one combined result. trailmix-codecs handles file decoding and mono prep. Persistence and transport are caller responsibilities.

Two entry points

trailmix_codecs::analyze_path() accepts an audio file and handles decoding, mono PCM prep, and analysis. trailmix::analyze() accepts mono PCM directly. Both return the same Analysis JSON.

Tradeoffs

The default analyzers use deterministic DSP rather than bundled neural-network weights. The core build remains small, inspectable, and fully offline, but will not match specialized ML systems on every dataset.

References

Analyzer crates

Each crate performs one analysis task and can be used on its own. The trail mix facade runs all three and returns one combined result.

beat salad

Estimates global BPM, beat positions with downbeat inference, and local tempo segments using autocorrelation with harmonic scoring and a gentle octave prior.

returns
BPM, beat grid, tempo segments

key lime

Estimates global and local major or minor keys with dual chroma extraction, multiple key profiles, median aggregation, and confidence-gated segmentation.

returns
Key, confidence, key segments

sampler platter

Generates compact min, max, and RMS waveform columns for display.

returns
Min, max, RMS waveform columns