The single best key interpretation of a pitch set.
The counterpart of detectChordBest: the ranked list is the general
answer, but a caller that just wants "what key is this" should not have to
index into it and assert the result is there. The winner is the candidate
whose key profile correlates best with the input distribution, with the same
deterministic tie-break detectKey applies, so its score is a finite
correlation in [-1, 1] rather than a membership share.
This is where DetectKeyOptions.explain earns its keep: the winner is
the only match a caller of this function sees, and with explain it carries
both its own rationale and the candidates it beat.
When weights does not have one entry per pitch,
profile is not a known name or a valid pair of 12-entry vectors, or
modes names something that is not a church mode.
Throws
When a pitch is outside the MIDI domain or the input
exceeds the budget.
The single best key interpretation of a pitch set.
The counterpart of detectChordBest: the ranked list is the general answer, but a caller that just wants "what key is this" should not have to index into it and assert the result is there. The winner is the candidate whose key profile correlates best with the input distribution, with the same deterministic tie-break detectKey applies, so its
scoreis a finite correlation in [-1, 1] rather than a membership share.This is where DetectKeyOptions.explain earns its keep: the winner is the only match a caller of this function sees, and with
explainit carries both its own rationale and the candidates it beat.