Chord Analysis
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.
--Parameters--
phrase: is the phrase to be
analysed
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.
--Return value--
Both methods return an array of
ints.
The length of the array
represents the number of beats in the phrase.
Element [0] represents the
first beat of bar 1, [1] the second beat of bar 1, [2] 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:
0: I
1: II
2: III
3: IV
4: V
5: VI
6: VII
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.
|