AUD · Audio tools

Key Detector

Detected key
Chromagramshare of energy
C
C♯
D
D♯
E
F
F♯
G
G♯
A
A♯
B

Shareable link

Settings are written to the URL as you change them. Nothing differs from the defaults yet.

Key detection is a question about which notes appear and how often, not about hearing a tonic. The file is reduced to twelve numbers, one per pitch class, and the key whose profile best matches those twelve wins.

The chromagram

Every FFT bin in the analysis band maps to the nearest semitone, and the semitone maps to one of twelve pitch classes. C2, C4, and C6 all count as C.

Two details do most of the work. Only bins that are a local maximum are counted, so the broadband energy of a snare does not add a little to all twelve classes at once. And every window is normalised before it is added, so a loud chorus and a quiet verse carry the same weight and the result does not move if you change the gain.

Relative keys share every note

C major and A minor use the same seven pitch classes. So do G major and E minor, and every other relative pair. A chromagram cannot tell them apart by content, only by weighting, which is why the two scores usually land within a few hundredths of each other.

When they do, the readout says so and names the alternative. A confident-looking percentage over a coin flip is worse than no answer.

Confidence

The figure combines two doubts: how far the winner stands above the runner-up, and how well the winner fits at all. A file that matches every key weakly is as unreliable as one where two keys tie.

Above roughly 70% the answer is worth acting on. Below 30%, read the ranked list instead of the headline.

Camelot codes

The wheel exists so a DJ can find compatible tracks without thinking in key signatures. Same number, different letter is the relative major or minor. One number up or down is a fifth away. Both blend.

The code appears next to the key name and in the copied JSON.

Where it fails

Music that changes key mid-track produces an average of the sections, which may be a key that never appears. Modal material sits between the major and minor profiles and reads as whichever is closer. Heavy distortion adds harmonics that were never played, and those harmonics land on real pitch classes.

Frequently Asked Questions

It folds every frequency bin onto one of twelve pitch classes to build a chromagram, then correlates that against all 24 major and minor key profiles. It reads WAV, MP3, M4A, AAC, Ogg, Opus, FLAC, AIFF, and WebM audio.

Profile correlation gets roughly three quarters of ordinary music right. Most of the misses are a key read as its relative, which shares all seven notes. The ranked list and the confidence figure are there so you can see when the answer is close.

It is the notation used for harmonic mixing. Keys one step apart on the wheel, or the same number with the letter swapped, share enough notes to blend. A minor is 8A and C major is 8B.

Krumhansl came from listener ratings and weights the tonic heavily, which suits music with a clear root. Temperley was refit to written scores and is flatter, which sometimes reads modal and jazz material better. Switching is instant because only the correlation runs again.

Percussion, speech, a single sustained note, and heavily processed noise have no tonal centre to correlate against. Rather than name whichever key scored least badly, it reports nothing.

Explore Our Tools

Browse all tools