Assuming I have access to the chords of a song, I 'know' (based on my own experience and training) what key the song is likely to be in. And for pop music, the recognition rate is easily above 95%. To be fair, for certain types of pop music the key is just the final chord of the song though.

Have there been attempts at deriving musical key from a list (ordered or unordered) of chords in the song? I'm looking for either a list of rules or (preferably) a computer program.

Initial thoughts:-

  • If a song has lots of C, F, and G major chords, it's probably in C
  • The first and/or last chord would have inordinate importance
  • Differentiating between Am and C would be much harder than between C and D

Clarifications:- - Let's just assume 'simple' music, pop-ish, meant for acoustic guitar/simple piano playing. - The 'chords' that I'm thinking about here are boring old guitar chords (Cmaj7, D/F#, Gsus4) style

  • What do you do to "know" what key a song is in? Can you determine a key from a list of chords? How are you doing that? That would answer your own question. – Todd Wilcox Jan 22 '16 at 6:38
  • Unordered? How is one going to do that without some idea of ordering and rhythmic priorities? If I use mostly major triads on F, C and G, I can tonicise F quite as easily as I can C (V/V - V - I). I can even end the piece on a C chord and make it seem like an unresolved ending on the dominant. So it will depend on the ordering (the progression), to be sure, but also on line and rhythm to make my key clear. – user16935 Jan 22 '16 at 7:02
  • @Patrx2 - I've often wondered about the situation you suggest. If, with only C, F and G, but construed to be 'in F', I think most of the B notes would be B rather than Bb.So, what would the key sig. have to be? If it was for F, then most of the Bbs would end up cancelled, in which case it could be generally thought of as, well, it's pretty much in C, isn't it? An example that comes to mind is Sweet Home Alabama. In D or G? I've seen in written in both! And in C, with zero key sig... – Tim Jan 22 '16 at 7:28
  • @Tim, the B notes are where line and rhythm come in. Imagine the G chord falling on a relatively unstressed beat, then dwelling on C for a while, then bringing in F on a beat where you expect a cadence to end, but imagine the F chord with a stressed B♭ appoggiatura. The B♭ is a linear artifact, a nonharmonic tone, but it has a harmonically disambiguating effect. Without the support of line and rhythm, a small number of chords can be extremely ambiguous, but, with the support of these elements, even a single chord can establish a tonality: see the Prelude to Das Rheingold. – user16935 Jan 22 '16 at 7:51
  • @Patrx2 - or could it be argued that the C/F/G song is in F is actually in F Lydian? What about a key sig? Point taken completely re. positioning of chord in bar/phrase. – Tim Jan 22 '16 at 8:02

I think you are on the right track, because you limit your question to a simple pop context. But, I would suggest this:

  • Always keep in mind a song can modulate. The whole song may be in one key, but you might also need to apply some "local" key changes to sections of a song.
  • Caveat: when pop styles use minor harmony there is a tendency for the music to not be in a key in the standard music theory sense. It will tend to be either modal - like d dorian in "Riders on the Storm" - or minor pentatonic scale oriented - like in hard rock songs such as "Hair of the Dog." Identifying a modal tonality is more complicated so we won't try to do it here.
  • The straight forward way to determine key is by finding the primary tonal triads: tonic, subdominant, dominant. In major keys this is simple: C, F, G or I, IV, V. In minor keys look for cm, fm, Gmaj or i, iv, V. You could find a chart listing all keys like this.
  • Keep in mind other chords are likely used even in a simple song. But for the purpose of identifying key you can disregard those chords, and focus on the primary triads. For example, in this common chord progression - C a-min F G (I vi IV V) you can disregard the a minor, the C, F, G chords match the primary chords for C major.
  • If a given song doesn't fit neatly into the steps above, you probably aren't dealing with simple songs, and will have to use more sophisticated methods. That's ok! Use a simple method when appropriate, switch to sophisticated analysis when needed.

Additional comments:

@Patrx2 and @Tim point out some good "gotchas." But, if you find such things in a particular song, it probably isn't the simple pop music your are focusing on and you won't be able to approach it with a simple formula/method.

You may find a lot of music that seems simple is not simple in terms of key/tonality. My simple outline will work well with a lot of Buddy Holly songs or 1960's doo-wop, etc. but it won't help much with many Beatles songs, and many, many other interesting songs.

  • ...and that last sentence sums up what is problematic about the venture. It's precisely when things get interesting that simple automation will be problematic, and even not-so-simple automation will be iffy. Hewing to the statistical mean is not very interesting; naming the key you're in is not very interesting; finding out how you got there is very interesting, but usually requires more than enumerating chords. – user16935 Jan 22 '16 at 17:30
  • I agree absolutely. Enumerating chords or notes which match a key is not enough. I hope my answer isn't misleading in this regard. I tried to give clear caveats to avoid that mistake. – Michael Curtis Jan 22 '16 at 18:44
  • Thanks for a very good answer, but for clarification - it sounds like you're suggesting chord counting and assuming that the 3 most numerous chords are I, IV, and V? Simple enough to do, and I'll have to test it with some of the songs I want to use, but as already mentioned by others this will be quite brittle with anything beyond the simplest (and won't cover what I personally consider 'pop', though I understand that to be subjective) – Ng Oon-Ee Jan 22 '16 at 18:53
  • Also, what would 'sophisticated analysis' look like? I'm skimming through "Music and Probability" now, which looks interesting except for the focus on melodic/note structure which is at odds with the 'based on chords' plan I have. The only relevant bit it seems to have is the 'relatedness' of keys. – Ng Oon-Ee Jan 22 '16 at 19:16
  • The easiest way to reduce complexity for an algorithm is a scoring mechanism that favors the most common choices, maybe start with the list of most common and then eliminate them somehow. I expect Differential Diagnosis algorithms might be helpful here. Remember: When you hear hoofbeats, look for horses, not zebras – Yorik Jan 22 '16 at 20:02

sure there is. same way ya do it manually.

relying on chords won't be as good as just using melody.

due to the chords often being dom7 and that minor7 being out of keysig. kinda.

take the melody, see where it's 7 most popular notes are, boom - there's your keysig usually.

due to pop usually being in major, vocals and bass usually staying in keysig.

I've tried this out on a bunch of pop midi files and it usually works great.

  • Thanks, but I'm more interested in something based on chords, primarily because it's easier to obtain chords than melody notes generally (in numbers, of course, not referring to any specific tune/song). – Ng Oon-Ee Jan 22 '16 at 18:55
  • using the notes of the chord will still work. the 7 most popular notes will still outweigh the minor 7ths cuz the chords's main 3 will build up way faster than the dom7. – Stephen Hazel Jan 22 '16 at 22:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.