There are two important public
methods in the ChordAnalysis class, getFirstPassChords and
getSecondPassChords. (Please ignore the getChords method -
it is meant to be package-private).
Their names were a relic from
the design of this particular algorithm, which involves two
passes. The important thing to know is that the
getSecondPassChords produces more favourable results.
In any case both require the
same parameters, and return the same type of values, which I
will know discuss.
phrase: is the phrase to be
beatLength: the length of a
beat, generally 1.0 which represents crotchets
tonic: a int representing the
MIDI value pitch of the tonic, for example C can be
represented by 0 or 60 or indeed any multiply of 12, C# by 1
or 61, G by 7 or 67.
scale: one of
PhraseAnalysis.MAJOR_SCALE or PhraseAnalysis.MINOR_SCALE.
If necessary, other scales can be implemented using the same
format as these examples.
Both methods return an array of
The length of the array
represents the number of beats in the phrase.
Element  represents the
first beat of bar 1,  the second beat of bar 1,  the
third beat of bar one, and so.
The value of the element will
always be in the range of 0 - 7. These values correspond to
the following chords:
7: no particular chord, or same
as previous. This generally occurs when you have things
like minims or semibreves. The down beat will have a chord
specified, but the second and consequent beats of the note
will have 7s.