How to Identify Musical Keys and Chords from Audio
An introduction to chroma vectors and the Krumhansl-Schmuckler algorithm for extracting harmonic progressions from recordings.
Harmonic analysis is central to songwriting, remixing, and music theory. While skilled musicians can identify chords by ear, modern signal processing can analyze the harmonic spectrum of an audio recording in seconds.
The 12-Dimensional Chroma Vector
To analyze harmony regardless of instrument timbre, the audio spectrum is collapsed into 12 semitone pitch classes: C, C#, D, D#, E, F, F#, G, G#, A, A#, and B. This 12-dimensional vector is called a chromagram.
The Krumhansl-Schmuckler Algorithm
In 1990, cognitive musicologists Carol Krumhansl and Mark Kessler established key profile ratings for all 24 major and minor keys. By calculating the Pearson correlation coefficient between the audio's chromagram and the theoretical profiles, the algorithm pinpoints the most mathematically probable musical key.
Related Tutorials & Articles
How to Transpose MIDI Files Online — Lossless Semitone Shift Guide
Transpose MIDI songs and melodies up or down by semitones losslessly while protecting drum channels, controllers, and velocities.
Tool TutorialsHow to Calculate Song BPM with Tap Tempo — Accurate Live Tempo Guide
Calculate the exact tempo of live songs, DJ tracks, and musical ideas by tapping to the rhythm with zero latency and statistical smoothing.