Commit
feat(audio-analysis): improve BPM, key, and loop detection accuracy
Commit details
Commit notes
Major improvements to audio analysis algorithms:
BPM Detection: - Replace first-order RC filters with 2nd-order Butterworth biquad filters (-12dB/octave) - Add beat tracking using Ellis-style dynamic programming for tempo verification - BPM detection only applied to detected loops (per design)
Key Detection: - Implement proper HPSS (Harmonic-Percussive Source Separation) using median filtering - Add tuning detection for non-A440 audio with sub-bin frequency accuracy - Implement segment-wise key detection with majority voting for longer samples - Use ensemble of Krumhansl-Kessler and Temperley profiles
Loop Detection: - Increase start/end comparison window from 50ms to 150ms - Add circular cross-correlation for phase-invariant matching - Add spectral continuity check at loop boundaries - Add amplitude discontinuity detection at loop points
Feature Extraction: - Integrate Meyda.js for improved MFCC and spectral feature extraction - More accurate spectralCentroid, spectralSpread, spectralRolloff, spectralFlatness - More accurate zero-crossing rate calculation
Co-authored-by: armin.naimi <[email redacted]>
- Files changed
- 3
- Lines added
- +1,104
- Lines removed
- −335