SongKeyFinder

Signal Processing Documentation

Audio Analysis Methodology & Honest Accuracy Limits

How our browser WebAudio DSP extracts chromagrams, key probabilities, BPM autocorrelation, chords, and MIDI notes with zero server upload.

Transparent Audio DSP Pipeline (Zero Black-Box Claims)

We publish our exact browser DSP pipeline so audio engineers, educators, and musicians understand both its strengths and its acoustic boundaries.

1. Musical Key Detection (chromaOf + detectKeyTop3)

  • Stereo Downmix & Windowing: Decoded PCM channels are averaged to mono and sliced with a 4096-sample Hann window across the core harmonic band (70 Hz – 2400 Hz).
  • 12-Bin Pitch-Class Chromagram: Each FFT magnitude bin maps via 69 + 12 · log2(f / 440) to one of the 12 chromatic pitch classes (C–B), then L2-normalized.
  • Krumhansl-Schmuckler Pearson Correlation: The normalized chroma vector correlates across all 24 rotations (12 Major + 12 Minor profiles). Softmax-scaled margins output the Top-3 candidate keys alongside an interactive WebAudio scale player for immediate human verification.

2. Tempo / BPM Estimation (detectBpm)

  • Onset Energy Flux: Computes positive frame-to-frame RMS energy differences (N = 1024, hop = 256), normalized against mean energy.
  • Autocorrelation Lag Sweep: Evaluates periodic lags across 64–192 BPM in 0.5 BPM increments, folding results into the primary 78–168 BPM range while displaying explicit Half (÷2) and Double (×2) companions.

3. Honest Acoustic Limitations

  • Key Changes Mid-Song: Songs that modulate up a semitone in the final chorus reflect the dominant weighted key across the first 75 seconds.
  • Heavy Detuning / Non-440 Hz Tape: Tracks pitched ±35 cents off standard A4 = 440 Hz can split chroma energy between adjacent semitones; use Note Frequency Chart or fine-cent shifting in Pitch Shifter when working with vintage analog transfers.
  • Polyphonic MP3-to-MIDI: Complex full-band rock/EDM mixes produce richer overtones than solo piano or vocal tracks; enabling Snap-to-Key on MP3 to MIDI significantly reduces stray chromatic notes.