IT lexicon › Programming › Key detection

Key detection

Programming På svenska → Updated: 2026-10-29

Letting an algorithm work out which key a recording is in, mostly so DJs can mix tracks that sit well together.

The core method comes from music psychology. Carol Krumhansl developed key profiles in the early 1980s — how well each pitch class is perceived to fit major and minor keys — and the Krumhansl–Schmuckler algorithm simply correlates a piece's pitch distribution against all 24 profiles and picks the best match. For audio, that distribution is built from a chromagram.

From the mid-2000s it became a product: tools like Mixed In Key tagged DJ libraries with Camelot wheel codes, turning harmonic mixing into picking neighbouring numbers. The failure modes are predictable. Relative keys such as C major and A minor share every note and get confused constantly, and modal music fits none of the profiles particularly well.

← Back to the lexicon