Unveil

BPM and key finder — tempo, key, tuning and chords from audio

By David Corl, audio engineer and founder of Unveil · Updated

Every Unveil analysis reads the music as well as the mix. Unveil Engine V3's musical module finds the tempo, beats and downbeats, time signature and swing, the key and mode with a confidence and the next-best candidates, key changes, the tuning offset from A440 and the chords. Every value is an estimate with a confidence, and the engine leaves a field empty rather than guess on material that does not support it. It is part of Analyze a Mix: a full mix analysis costs 5 ProCoins a track. You get the whole report with it. The account is free and comes with 100 free ProCoins to start, enough for 20 full mix analyses at 5 ProCoins each. No credit card or payment details needed. You earn more without paying: 20 free ProCoins for every 30 days, added the next time you sign in, and 15 for each producer who signs up with your referral link, with bonus coins from 3 referrals. Unveil's online tools run on ProCoins, pay per use, with no subscription.

How the tempo is found

The audio is summed to mono and reduced to about 11 kHz (files above 48 kHz are decimated cleanly first). A spectral-flux onset envelope marks where new sounds start. Its autocorrelation is scored as a comb over several beat multiples between 50 and 220 BPM, with a perceptual weighting centred on 120 BPM so the engine prefers the tempo a listener would tap over a half or double reading.

Then come the corrections that usually separate a good BPM finder from a bad one. If the half-beats are at least 85% as strong as the beats, the doubled tempo is taken (up to 200 BPM). Candidates at 3:4, 2:3, 4:3 and 3:2 of the tempo are re-scored and win only when they are clearly stronger, which fixes cases like 85 BPM with sixteenth-note hats reading as 113. A fine search in 0.02 BPM steps, a dynamic-programming beat tracker and, when the beats are regular, a least-squares fit of beat time against beat number give the final value.

Meter, swing and groove

With the beats in place, the engine compares accent patterns for three and four beats per bar (onsets, low-frequency hits and harmonic changes) to estimate the time signature, with a prior for 4/4 so that three has to win clearly. It folds the onset envelope over the beat to measure the swing ratio (1 means straight), and measures groove tightness as how far onsets fall from a sixteenth-note grid, in milliseconds. Local tempo, stability and drift come from fitting the beat times over a few beats at a time.

How the key and mode are found

First the engine measures the tuning: an amplitude-weighted histogram of how far spectral peaks between 80 Hz and 4 kHz sit from the nearest A440 equal-tempered semitone. The chroma is corrected by that offset, so a track tuned 30 cents flat is not split between two keys. The chroma is then correlated with the Krumhansl-Kessler and Temperley major and minor profiles at all 12 rotations each, and the two correlations are averaged.

The confidence combines how strong the best match is with how far ahead of the second-best key it is. A song whose best key barely beats its relative major or minor gets a lower confidence, and the candidates list shows the alternatives. On tracks of 40 seconds or more, the same scoring on 16-second windows every 2 seconds, smoothed with a Viterbi path, finds key changes.

Chords

Chords are decoded from the chroma and a separate bass profile with harmonic templates for 12 roots and eight chord types (major, minor, 7, maj7, m7, dim, sus2 and sus4) plus no-chord, 97 states in all, using a hidden Markov model so chords do not flicker frame by frame. When beats exist the chords are beat-synchronous. Quiet segments, and segments whose chroma is nearly flat (drums, noise, breath), are decoded as no-chord instead of forcing a label. For the full progression, harmonic rhythm and MIDI export of the chords, see the chord finder and the audio-to-MIDI pages.

Using tempo and key in a mix

An alternative to standalone key-detection apps

Dedicated key-detection apps focus on tagging a library for DJing. Unveil is a mix analyzer, so the tempo and key come with the rest of the report on the same file: loudness, dynamics, tonal balance, stereo and a fix plan for your DAW. If all you need is a batch of keys for a library, a dedicated app is quicker. If you are producing or mixing the track, having the key, the tuning and the low-end measurements side by side is the useful part.

What you get

Questions

How is the key detected?

The engine builds a pitch-class profile (chroma) from the audio, corrected for the measured tuning, and correlates it with two published key profiles, Krumhansl-Kessler (1982) and Temperley (1999), at all 24 major and minor keys. The key with the best average correlation wins, and the top three are listed with their scores.

Why does it sometimes show no key?

If too little of the track is pitched (fewer than 20 voiced analysis frames) or the best key correlates weakly with the music, the key is left empty instead of guessed. Drum loops, noise-based sound design and very atonal music often have no meaningful key.

How accurate is the BPM?

The tempo search covers 50 to 220 BPM, weighted toward the tempos people usually tap, and it checks for half-time and double-time errors. When the beats are regular, the final BPM comes from a least-squares fit of the beat times. It is still an estimate: songs with tempo changes, rubato or no steady pulse get a lower confidence, and 0 BPM means no pulse was found.

What does it cost?

It is part of Analyze a Mix: a full mix analysis costs 5 ProCoins a track. You get the whole report with it. The account is free and comes with 100 free ProCoins to start, enough for 20 full mix analyses at 5 ProCoins each. No credit card or payment details needed. You earn more without paying: 20 free ProCoins for every 30 days, added the next time you sign in, and 15 for each producer who signs up with your referral link, with bonus coins from 3 referrals. Unveil's online tools run on ProCoins, pay per use, with no subscription.

Learn it in the free Academy

Related

Analyze your mix: free account, 100 free ProCoins. No credit card or payment details needed.