| Crates.io | stratum-dsp |
| lib.rs | stratum-dsp |
| version | 1.0.0 |
| created_at | 2025-12-19 01:30:19.497539+00 |
| updated_at | 2025-12-19 01:30:19.497539+00 |
| description | Professional-grade audio analysis engine for DJ applications: BPM detection, key detection, and beat tracking |
| homepage | |
| repository | https://github.com/HLLMR/stratum-dsp |
| max_upload_size | |
| id | 1993979 |
| size | 4,455,500 |
Professional-grade audio analysis engine for DJ applications — pure Rust, zero FFI dependencies, production-ready BPM detection, key detection, and beat tracking.
1A/1B)
Add to your Cargo.toml:
[dependencies]
stratum-dsp = "1.0"
Add to your Cargo.toml:
[dependencies]
stratum-dsp = { git = "https://github.com/HLLMR/stratum-dsp" }
Note: The API is stable for core features (BPM/key/beat-grid). Advanced tuning parameters may change in future versions.
use stratum_dsp::{analyze_audio, compute_confidence, AnalysisConfig};
// Load your audio samples (mono, f32 in [-1, 1])
let samples: Vec<f32> = vec![]; // Your audio data
let sample_rate = 44_100;
// Analyze
let result = analyze_audio(&samples, sample_rate, AnalysisConfig::default())?;
let conf = compute_confidence(&result);
println!("BPM: {:.2} (confidence: {:.2})", result.bpm, conf.bpm_confidence);
println!("Key: {} ({})", result.key.name(), result.key.numerical()); // e.g., "C major (1A)", "Am (1B)"
println!("Beat grid stability: {:.2}", result.grid_stability);
# Ok::<(), stratum_dsp::AnalysisError>(())
Single file analysis:
cargo build --release --example analyze_file
target/release/examples/analyze_file --json <audio_file>
Batch processing (parallel):
cargo build --release --example analyze_batch
target/release/examples/analyze_batch --jobs 7 <file1> <file2> ...
Stratum DSP has been validated on real-world DJ tracks from Beatport and ZipDJ (155 tracks with verified ground truth):
| Metric | Result |
|---|---|
| BPM accuracy (±2 BPM) | 87.7% (136/155 tracks) |
| BPM accuracy (±5 BPM) | 88.4% (137/155 tracks) |
| BPM accuracy (±10 BPM) | 89.0% (138/155 tracks) |
| BPM MAE | 6.08 BPM |
| Key accuracy | 72.1% exact match vs GT (68 tracks) — matches MIK performance |
Dataset: 155 verified DJ tracks (Beatport/ZipDJ) with ground truth BPM/key from vendor tags (pre-MIK snapshot).
Reference baseline: Mixed-in-Key (TAG) achieves 98.1% ±2 BPM and 72.1% key accuracy on the same dataset.
Note: FMA Small dataset results (used for algorithm development) show lower accuracy (56.7% ±2 BPM) due to dataset diversity. Real-world DJ tracks achieve production-grade accuracy as shown above.
For detailed validation reports, see:
docs/progress-reports/PHASE_1F_VALIDATION.md (FMA Small development results + real-world DJ results)docs/literature/stratum_2025_key_detection_real_world.md (key detection improvements)validation/README.md (validation workflow)Example: Processing 1000 tracks takes ~6 minutes with CPU-1 workers (vs ~45 minutes single-threaded).
For detailed benchmark reports, see docs/progress-reports/PHASE_1F_BENCHMARKS.md.
Full literature review: docs/literature/
PIPELINE.md — exact runtime flow and decision pointsDEVELOPMENT.md — build, test, benchmark, validateROADMAP.md — high-level milestonesdocs/progress-reports/ — detailed phase histories and tuning logsvalidation/README.md — how to reproduce validation resultsContributions are welcome! Please see the documentation in docs/ for algorithm details and DEVELOPMENT.md for build/test workflows.
Note: This project follows a phased development approach. Phase 1 (DSP-first) is focused on core tempo/key/beat-grid accuracy. Phase 2 will add optional ML refinement.
Dual-licensed under MIT OR Apache-2.0 at your option.