MIDILACE Runs on your device
METHOD · KEY

How to find the key of a song: the pitch set first, the bass note last.

The key is not in the recording, and it is not in the export either. The MIDI file this site produces declares no key signature, no tempo and no time signature — three meta events the format supports and this file uses none of. What it does carry is a pitch set. On the site's 4.40-second mix, five pitches collapse to four pitch classes (A, C, D, E); those four cut the 24 major and natural-minor keys down to eight; the lowest note, A3, held for 4.006 of the 4.40 seconds, points at A minor. The method below is that order — set, then candidates, then bass — and it is the same order every time.

Convert a clip and read its pitch set
WHAT THE FILE DOES NOT SAY

Three meta events the format allows, none of them present

The Standard MIDI File spec reserves meta events for tempo (0xFF 0x51), time signature (0xFF 0x58) and key signature (0xFF 0x59). A file can therefore state its own key. The export of this site's test mix states none of the three — the byte-level check below is on /examples/midilace-mix-test.mid, a format-1 file with two tracks and 480 ticks per quarter note.

Meta events found in the 4.40-second mix export
Meta eventStatus in this fileWhat it would have told you
Tempo (0xFF 0x51)absentThe player falls back to the spec default, 120 BPM
Time signature (0xFF 0x58)absentHow many beats per bar, and which note value gets the beat
Key signature (0xFF 0x59)absentHow many sharps or flats, and major or minor
Track name (0xFF 0x03)present, emptyNothing — both tracks are named with an empty string

This is not a defect of one converter. A pitch detector measures frequencies; a key signature is a notational decision about those frequencies, and nothing in the audio says which of the eight keys below was intended. The file gives you the notes and stops there. Finding the key is the step you do afterwards, and it is a judgement you can make checkable.

STEP ONE

Collapse octaves, then count what survives

The mix export holds 13 events on five pitches: A3 seven times, A4 twice, C5 twice, E5 once, D5 once. Octave is a register, not a letter, so collapse the five pitches to their pitch classes: A, C, D, E. Four letters, not five — A3 and A4 are the same letter, and that duplication is the single most common reason a hand-counted pitch list overstates how much the file tells you.

Which of the 24 major and natural-minor keys contain all four pitch classes A, C, D, E
KeyIts seven notesSignatureVerdict
C majorC D E F G A Bnonesurvives
G majorG A B C D E F♯1 sharpsurvives
F majorF G A B♭ C D E1 flatsurvives
B♭ majorB♭ C D E♭ F G A2 flatssurvives
A minorA B C D E F Gnonesurvives
E minorE F♯ G A B C D1 sharpsurvives
D minorD E F G A B♭ C1 flatsurvives
G minorG A B♭ C D E♭ F2 flatssurvives
The other sixteenD major, A major, E major, B major, F♯ major, C♯ major, E♭ major, A♭ major, D♭ major, G♭ major, C minor, B minor, F♯ minor, C♯ minor, F minor, B♭ minor—each contains a note the file never plays

The exclusions are mechanical, not taste. D major and A major both require C♯ and the file plays C natural twice. E major requires C♯ and D♯. E♭ major requires A♭ and the file plays A natural seven times. That is why the count drops from 24 to 8: each of the four pitch classes is a hard constraint, and the sixteen eliminated keys each break at least one of them.

Thirteen exported events on five pitch lanes, with the A3 lane in orange holding seven events that total 4.006 seconds, and the eight keys that contain all four pitch classes.
Five pitch lanes on the left; the eight keys that survive the four pitch classes on the right.
STEP TWO

The bass note is the tiebreaker, and it is measurable

Eight keys, one answer, and the deciding evidence is not in the chord — it is in which note is lowest and longest. On this export the A3 lane holds seven events spanning 0.000 to 4.006 seconds, which is 91 percent of the 4.40-second input. No other pitch is held for more than 0.882 seconds. A pitch that sounds for nine tenths of the file is the tonal centre in the only sense the file can express.

Two more details settle the quality. The first onset is A3 at 0.000 s, so the file begins on that pitch. And the third above it is C natural — the minor third, present twice as C5 — not C♯. A minor third over a sustained A is A minor; the same bass with a C♯ would be A major, and A major was already eliminated by the pitch set in the table above. The reading is A minor, and every step of it can be re-run from the file.

The evidence that separates A minor from the other seven survivors, in the order it was read
ObservationMeasured valueWhat it rules out
Lowest pitch in the exportA3 (MIDI 57)Keys centred on C, G, F, B♭, E, D — those put a different note at the bottom
Time that pitch is held4.006 s of 4.40 s (91%)A passing bass note; this one never leaves
First onset0.000 s, A3An anacrusis or a pickup built on another degree
Third above the bassC natural (C5 twice)A major — it needs C♯, which the file never plays
THE PROCEDURE

The same five steps on any song

  1. Export or transcribe first, then list pitches, not notes. On this file that is 13 events, 5 pitches, 4 pitch classes. Write the pitch classes down before you listen again — the ear jumps to a key in about two seconds and then hears everything as confirming it.
  2. Delete keys, do not add them. Start from all 24 and cross off any key missing one of your pitch classes. Four pitch classes left eight keys here; a five-note melody usually leaves three or four.
  3. Find the lowest sustained pitch and time it. Not the lowest single note — the lowest note you can time. 4.006 s of A3 is evidence; a 0.081 s blip at the bottom is an artefact.
  4. Check the third above that bass. Natural or flat third reads minor, natural or sharp third reads major. This is the step that separates a relative pair like C major and A minor, which share a signature and a pitch set.
  5. Say which evidence is missing. If the bass is ambiguous, or the file is a four-bar loop with no sustained note, the honest answer is "two candidates", not a guess. On a loop, listen for which chord the phrase resolves to and mark it as inference, not measurement.

One warning that saves an hour: a converter export is a pitch estimate, not a transcription. The site's 12-second guitar case produced 68 events against 45 annotated notes, and the voice case 47 against 31 — extra events at the octave and at harmonics. Before you count pitch classes, merge same-pitch events and drop anything under roughly 70 ms, or the pitch set you build will contain notes nobody played.

QUICK ANSWERS

Questions about finding a song's key

Is the key stored anywhere in an audio file?

No. Neither WAV nor MP3 has a field for it, and a converter has nothing to copy it from. The MIDI export could carry it as a key signature meta event, but the export measured here carries none — the check is three bytes per meta event and takes a minute.

Why eight keys and not one?

Because four pitch classes are not enough information. A, C, D and E appear in eight of the 24 major and natural-minor keys, and nothing in those four notes distinguishes C major from A minor — they share all seven notes. You need the bass, the third, or the phrase ending to break the tie.

Can I just use a key-detection tool?

You can, and it will give you one answer with no indication of how close the second was. The useful output is the candidate list with the evidence that eliminated each one — which is what the tables above do by hand in about five minutes on a short file.

What if the song changes key?

Then a single pitch set is the wrong tool and will produce a set that fits neither key. Cut the file at the change and run the method per section. A modulation shows up as a pitch class that only appears after a certain point — on a 4.40-second file there is no room for one, but on a three-minute track there usually is.

Does a wrong key matter if I am only transcribing?

It matters for the notation, not for the notes. The MIDI note numbers are unchanged either way; what changes is how many sharps or flats the staff shows and which note names the reader sees. Pick the key that minimises accidentals and matches the bass — then the staff is readable and the notes are still the ones that were played.