key [-af] [inputfile ...]
The input may be either
**semits
or
**kern
representations.
The program adapts to input having varying
numbers spines each with a different interpretation.
Output consists of three items of information:
The algorithm is based on Krumhansl's perceptually-based key-finding method
(see references).
This method compares a given pitch-class
frequency profile with two perceptually-determined prototypes
(one each for major and minor modes).
The coefficients used for these prototypes are those
determined by
Krumhansl & Kessler (1982).
In order for the algorithm to work properly, durational information
ought to be provided.
When using
**semits
format input, best results are achieved when
the input has a
time-base
format.
(See the
timebase (4)
command.)
The key command is poor at distinguishing less common enharmonic keys. For example, it is unable to distinguish the following enharmonic spellings for tonic pitches: C-flat, B-sharp, E-sharp, F-flat. Also, key is unable to distinguish enharmonic spellings involving double- or triple- sharps or flats. That is, G double-sharp major is identified as A major. KEY is able to distinguish the more common enharmonic spellings (such as E-flat versus D-sharp).
There is no special output file-type designation.
Options are specified in the command line.
-a output correlation values for all keys -f output frequencies for all pitch-classes -h displays a help screen summarizing the command syntax
The -a option will show all of the correlation coefficients for all 24 of the (enharmonic) major and minor keys.
The -f option will output the relative frequencies for each of the twelve chromatic pitch classes (in quarter-note durations).
Estimated key: B minor (r=0.8442) confidence: 51.3%
With both the
-f
and
-a
options invoked, a typical output is given below.
The
-f
option causes 12 pitch-class tallies to be outputted.
These values are given in acculumated whole-note durations.
For example, the output: "PC[5]: 4.25" means that the
enharmonic pitch-class "F" appears in the passage for the
equivalent of 4 whole-notes plus a quarter-note duration.
If inputs do not include durational information (such as in
**semits
input), each note is assigned the nominal duration of a quarter-note.
The -a option causes the tonic major and minor correlations to be printed for each pitch-class. Good key matches have a high positive correlation; the maximum value is 1.0.
PC[0]: 5.50617 PC[1]: 0.375 PC[2]: 6.1875 PC[3]: 0 PC[4]: 5.625 PC[5]: 4.25 PC[6]: 1.25 PC[7]: 5.6875 PC[8]: 0.5 PC[9]: 4.625 PC[10]: 0.625 PC[11]: 4.40625 Tonic[0] major 0.791744 minor 0.0962456 Tonic[1] major -0.747033 minor -0.337397 Tonic[2] major 0.506935 minor 0.535771 Tonic[3] major -0.404982 minor -0.720203 Tonic[4] major 0.0308014 minor 0.64007 Tonic[5] major 0.475928 minor -0.13113 Tonic[6] major -0.735928 minor -0.157988 Tonic[7] major 0.772586 minor 0.205276 Tonic[8] major -0.574103 minor -0.487743 Tonic[9] major 0.232566 minor 0.66303 Tonic[10] major -0.014411 minor -0.625767 Tonic[11] major -0.334105 minor 0.319835 Estimated key: C major (r=0.7917) confidence: 5.7%
In the above sample output, notice that the confidence score for the predicted key of C major (Tonic[0]) is quite low. The reason for this is that the correlation coefficient for A minor (Tonic[9]) is rather close to that for C major (0.791744 versus 0.66303) Note that confidence scores may be used as a simple index for estimating the tonal ambiguity or degree of chromaticism for a passage.
**kern (2),
kern (4),
**semits (2),
semits (4),
timebase (4)
**kern
spines.
**semits
and
**kern
interpretations.
If no recognizable interpretation is
given in the input stream,
key
assumes
**kern
compatible input.
This may lead to erroneous results.
Krumhansl, C. L. & Kessler, E. J. "Tracing the dynamic changes in perceived tonal organization in a spatial representation of musical keys," Psychological Review, Vol. 89 (1982) pp.334-368.