Audio Key Detector
Guess a major or minor key from an uploaded recording by tracking a pitch and scoring it with Krumhansl-style profiles.
🔒 Processed entirely in your browser — nothing you enter here is ever uploaded.
The result appears on this page after you run the tool. Nothing you enter is uploaded.
Result
About this tool
Upload a file the browser can decode, then run the check. The buffer is mixed to mono by adding the channels and dividing by the channel count. Analysis stops at 75 seconds even if the file is longer. The caption says so: the analyzed duration is the minimum of the file length and 75 seconds. Frames are 4096 samples, and the hop is 0.18 seconds of the file's sample rate, floored. Each frame looks for one fundamental. The search lag runs from the lag of 1046 Hz to the lag of 55 Hz. The score at a lag is the sum of sample times the sample that far ahead, stepping by two samples. The lag with the highest score wins, and the frequency is the sample rate divided by that lag. A frame whose frequency falls outside 55 Hz to 1760 Hz is dropped. The others add their frame energy into one of 12 pitch-class bins.
The bins are scored against two fixed profiles. Major is 6.35, 2.23, 3.48, 2.33, 4.38, 4.09, 2.52, 5.19, 2.39, 3.66, 2.29, 2.88. Minor is 6.33, 2.68, 3.52, 5.38, 2.60, 3.53, 2.54, 4.75, 3.98, 2.69, 3.34, 3.17. Those are the Krumhansl-Kessler probe-tone weights. For each of the 12 tonics and for both modes, the page multiplies each chroma bin by the profile weight of that pitch class relative to the tonic, and sums. If the chroma total is 0, the list is empty. Otherwise the best sum is scaled to 100 and the other sums are scaled by the same factor and rounded. The report keeps the top five. A confidence of 100 means this key had the largest dot product, not that the estimate is certain.
The method wants one clear fundamental. A chord, a drum loop, or two singers a third apart will still produce a number, because every frame contributes at most one pitch. Metadata, a key tag, and the file name are never opened. The warning line in the report says the result is approximate and best for clear tonal recordings. There is no way to tell the page the tuning is not A440 beyond what the pitch detector measures, and the pitch-class step uses the usual 12-tone equal map from frequency. A clip shorter than one hop can produce an empty chroma and the no-key message. The result is text you can copy: the analyzed duration, the warning, and five lines of key name, mode, and percent. It does not write a music-XML file, transpose the audio, or play the scale. Use it as a second opinion on a solo line, a vocal, or a simple harmonic recording. Do not treat the top percent as a probability from a trained model. It is the best profile score divided into the others.
Example. A decoded file is mixed to mono, scanned for at most 75 seconds, and turned into 12 pitch-class bins. The best of the 24 Krumhansl major and minor scores is scaled to 100, and the report lists five keys.
Limit. Each frame contributes one autocorrelation fundamental between 55 Hz and 1046 Hz, accepted up to 1760 Hz. Tags are ignored, and a confidence of 100 only means that profile won.
How does this pick a key?
The mono mix is cut into 4096-sample frames, hopping 0.18 seconds, and stopped at 75 seconds. Each frame's autocorrelation peak becomes one pitch class if it sits between 55 Hz and 1760 Hz. Those bins are dotted with the Krumhansl-Kessler major and minor profiles at every tonic. The largest dot product is shown as 100.
Does 100 percent mean the key is certain?
No. The percents are the 24 scores divided by the best score and rounded. The winner is always 100 if any pitched frame was found. The gap down to the second line is the useful part. Drums, chords, and speech still produce a ranking, because the detector forces one fundamental per frame.
Will it read the key tag in the file?
No. The decoder supplies samples. The file name and any tag are not opened. A clip with no accepted pitch returns the empty-result line. Analysis never looks past 75 seconds, even when the duration caption of a longer file is capped at that.
What recordings is this aimed at?
A single line or a simple tonal texture, where one fundamental at a time is a fair summary. The report says the result is approximate. It does not transpose audio or write a score. The profiles are the fixed 12-number major and minor lists in the script.