Rank major and minor keys by how well they contain a set of pitch classes.
The tonic is weighted so that, among equally-fitting keys, the one whose root
appears in the input is preferred. Minor candidates are scored against the
natural, harmonic, and melodic minor variants and keep the best of the three,
so a minor cadence containing the leading tone still resolves to its own
tonic; the returned key is always the natural-minor scale. Returns all 24
keys ranked best-first, or an empty array for an empty input (mirroring
detectChord).
Rank major and minor keys by how well they contain a set of pitch classes.
The tonic is weighted so that, among equally-fitting keys, the one whose root appears in the input is preferred. Minor candidates are scored against the natural, harmonic, and melodic minor variants and keep the best of the three, so a minor cadence containing the leading tone still resolves to its own tonic; the returned key is always the natural-minor scale. Returns all 24 keys ranked best-first, or an empty array for an empty input (mirroring detectChord).