How It Works

BPMKeyFinder.com analyses uploaded audio files to detect tempo (BPM), musical key, and Camelot Wheel notation. This page explains the complete technical process — how your file is decoded, how BPM is detected from rhythmic content, how musical key is identified from harmonic content, how the Camelot Wheel position is determined, and what affects the accuracy of each analysis.

Written and maintained by Charlotte Hayes, founder of BPMKeyFinder.com.


Overview: Two Separate Analysis Pipelines

BPM detection and key detection are fundamentally different signal processing problems. They analyse different properties of the audio signal, use different algorithms, have different accuracy profiles, and fail in different ways for different types of music. Understanding this is important for interpreting results correctly.

BPM detection is a rhythmic analysis — it identifies the periodic pulse in the track’s onset energy (the pattern of beats and rhythmic events) and measures the time interval between beats.

Key detection is a harmonic analysis — it identifies which pitch classes dominate the track’s spectral content and matches that distribution against the 24 possible major and minor keys.

Both analyses run on the same decoded audio data from your uploaded file. Neither requires a microphone. Neither transmits any data to any server.


Part 1 — File Upload and Decoding

Supported Formats

BPMKeyFinder.com accepts audio files in MP3, WAV, FLAC, AAC (.m4a), and OGG formats.

What Happens When You Upload a File

Step 1 — Local file reading. When you select or drag an audio file, the browser’s FileReader API reads the file from your device’s local storage into browser memory. The file does not travel over the internet at any point. It never reaches any server operated by BPMKeyFinder.com.

Step 2 — Audio decoding. The raw audio file data is decoded into a raw audio waveform (PCM samples) using the browser’s AudioContext.decodeAudioData() function. This produces an AudioBuffer — an in-memory representation of the audio as an array of sample values at the browser’s native sample rate (typically 44,100 or 48,000 samples per second).

Step 3 — Analysis. The decoded AudioBuffer is passed simultaneously to the BPM detection algorithm and the key detection algorithm. Both run locally in the browser using JavaScript.

Step 4 — Results display. The detected BPM, key, and Camelot Wheel notation are displayed on screen.

Step 5 — Session end. When you navigate away or close the tab, the decoded audio data is cleared from browser memory. No audio data is retained in any form after the session ends.


Part 2 — BPM Detection

How BPM Is Detected

BPM detection works by identifying the rhythmic pulse of the track — the periodic beat pattern produced by drums, bass hits, and other percussive events.

Step 1 — Onset detection. The algorithm scans the decoded audio for onsets — moments where the audio energy increases sharply, indicating a beat or percussive event. The standard approach measures the spectral flux between consecutive short analysis windows: a large positive spectral flux value means new audio energy has appeared across frequency bands, indicating a percussive onset.

Step 2 — Onset strength envelope. The detected onsets are combined into an onset strength envelope — a time series representing the rhythmic energy of the track over time.

Step 3 — Autocorrelation. The onset strength envelope is analysed using autocorrelation — a mathematical operation that measures how similar the envelope is to a time-shifted copy of itself. A strong autocorrelation peak at lag T means the rhythmic pattern repeats with period T milliseconds. This period corresponds directly to the beat interval.

Step 4 — BPM calculation. The beat interval T is converted to BPM:

BPM = 60,000 ÷ T (ms)

Step 5 — Tempo candidate evaluation. The algorithm evaluates multiple candidate tempos (including half-time and double-time candidates) and returns the most musically plausible result alongside alternative candidates.

BPM Accuracy and Limitations

For music with a clear, consistent rhythmic structure — electronic dance music, pop, rock, hip-hop — BPM accuracy is typically within ±1 BPM of the actual tempo.

Half-time and double-time ambiguity. The autocorrelation function produces strong peaks at both the beat period and its multiples. A track at 70 BPM will produce strong candidates at 70, 140, and sometimes 35 BPM. The algorithm selects the most plausible candidate — but for music where the rhythmic structure is genuinely ambiguous (many trap and hip-hop tracks, for example), the result may reflect double-time or half-time rather than the intended notated tempo. Both candidates are listed in the result so you can select the correct interpretation.

Tempo variation. Tracks with significant tempo drift, rubato, or abrupt tempo changes will produce less reliable results since the autocorrelation assumes a consistent pulse throughout the analysis window.

Sparse or ambient music. Tracks with few onset events — ambient, classical, or minimalist music — provide limited data for beat tracking and may produce unreliable results.


Part 3 — Key Detection

How Musical Key Is Detected

Key detection is a fundamentally different problem from BPM detection. Rather than identifying a rhythmic period, it identifies the harmonic centre of the track — which pitch class acts as the tonal root, and whether the music is organised in a major or minor mode.

Step 1 — Short-Time Fourier Transform (STFT). The decoded audio is divided into overlapping short analysis frames and each frame is transformed from the time domain to the frequency domain using the Fast Fourier Transform (FFT). This produces a sequence of frequency spectra showing which frequencies are present and at what amplitude throughout the track.

Step 2 — Pitch class binning (chromagram computation). The frequency spectrum at each analysis frame is mapped to the twelve pitch classes of the chromatic scale (C, C#, D, D#, E, F, F#, G, G#, A, A#, B). Each frequency bin is assigned to its nearest pitch class based on equal temperament tuning (A4 = 440 Hz). The energy at each pitch class is summed to produce a chroma vector for that frame.

Step 3 — Aggregation. The chroma vectors across all frames are aggregated to produce a single 12-element chromagram (also called a Harmonic Pitch Class Profile or HPCP) representing the overall pitch class energy distribution of the entire track. Pitch classes that are consistently prominent throughout the track will have high chromagram values; pitch classes that rarely appear will have low values.

Step 4 — Key profile matching. The chromagram is compared against the 24 key profiles (12 major + 12 minor) established by the Krumhansl-Schmuckler model of tonal cognition. These profiles encode the expected pitch class prominence in each key — in C major, for example, C, E, and G are expected to be most prominent, followed by other diatonic scale degrees. The comparison is performed using cosine similarity — the key whose profile most closely matches the track’s chromagram is returned as the detected key.

Step 5 — Mode identification. The comparison simultaneously identifies whether the best-matching profile is major or minor, returning both the root note and the mode (e.g. “A minor” or “C major”).

Key Detection Accuracy and Limitations

Key detection accuracy using chromagram + key profile matching is typically above 80% on popular music genres with clear tonal content.

Key changes within a track. The chromagram aggregates pitch class energy across the entire track. A track that modulates between two keys will produce a chromagram that is a blend of both, often resulting in incorrect key identification. The result will tend toward the key that dominates more of the track’s duration.

Modal and atonal music. Music in Dorian, Phrygian, Lydian, or other modes may not match well against the major/minor key profiles and can produce incorrect identifications. Atonal music has no tonal centre by definition and key detection is not applicable.

Short files. Very short audio clips (under 30 seconds) may not contain enough harmonic content for reliable key identification. Analyse the full track or the most harmonically representative section.

Heavily compressed or distorted recordings. Heavy limiting, clipping, or distortion can alter the spectral content in ways that affect pitch class energy distribution and reduce key detection reliability.

Confidence score. The strength of the best matching key profile’s cosine similarity score is returned as a confidence indicator. A low confidence score suggests the track’s harmonic content is ambiguous — the result should be verified by ear.


Part 4 — Camelot Wheel Mapping

Once the musical key and mode are identified, the result is automatically mapped to its Camelot Wheel position — the harmonic mixing system standard used in Rekordbox, Traktor, and Serato.

The Camelot Wheel assigns each of the 24 keys a number (1–12) and a letter (A = minor, B = major):

KeyCamelotKeyCamelot
A♭ minor / G# minor1AB major1B
E♭ minor / D# minor2AF# major / G♭ major2B
B♭ minor / A# minor3AD♭ major / C# major3B
F minor4AA♭ major / G# major4B
C minor5AE♭ major / D# major5B
G minor6AB♭ major / A# major6B
D minor7AF major7B
A minor8AC major8B
E minor9AG major9B
B minor10AD major10B
F# minor / G♭ minor11AA major11B
C# minor / D♭ minor12AE major12B

Harmonic Compatibility Rules

  • Same number, A↔B (e.g. 8A ↔ 8B): Relative major/minor pair — maximum harmonic compatibility, seamless transitions
  • Adjacent numbers ±1 (e.g. 8A → 7A or 9A): Keys share most pitch classes — natural, smooth transitions
  • +7 positions clockwise: Energy boost modulation — creates a lift effect in energy
  • –7 positions (or +5): Energy drop — creates a calmer, settling effect


What the Tool Cannot Determine

Time signature. The tool detects BPM — the number of beats per minute — but cannot determine whether those beats are organised in 4/4, 3/4, 6/8, or any other meter.

Vocal key vs instrument key. If a vocal is prominently out of tune with the backing track, the chromagram analysis will reflect the combined pitch content of both.

Key of individual stems. The analysis reflects the key of the full mixed track. Individual stem key analysis requires separate file upload of each stem.

Live performance pitch variations. If the recording features significant pitch variation (a choir with vibrato, a string orchestra with natural pitch drift) the chromagram will spread energy across adjacent pitch classes, potentially reducing key identification confidence.


Related Pages


This How It Works page is written and maintained by Charlotte Hayes, founder of BPMKeyFinder.com. Last updated: June 2026.

Scroll to Top