Whenever I play a song in Virtual DJ, it instantly gives me the key. How does this work? How are major or minors handled? Is there an analysis of the most common notes that is broken down to figure out what's most prominent?
This is not authoritative at all but here is my best guess. It does a simple frequency analysis to see what notes are present. Each key as 7 notes that can be present and 5 that cannot. As soon as it detects a note that is not in a key, it can rule that key out.
Then, the keys of C and A minor (for example) have the same notes so the answer it has so far is ambiguous. It then sees whether the piece contains more Cs or As to pick between the two.
If this answer is totally out to lunch please feel free to correct it.