//represents all possible chords
ChordTemplate fullSpectrum[] = new ChordTemplate[progression.size()];
//represent the current chords
Chord chordArray[] = new Chord[progression.size()];
//allows the program to step back as many times as possible to revoice a progression
ArrayList<Chord> backupVector[] = new ArrayList[progression.size()];
//times that a current chord has been checked and has 0 voicings
int times[] = new int[progression.size()];
//initialize all times to zero
for (int i = 0; i < times.length; i++)
times[i] = 0;
//For the entire progression....
for (int i = progression.size() - 1; i > -1; i--) {
parent.appendInfo("i = " + i + ", ");
String currentSymbolID = progression.getIdentifier(i);
String nextSymbolID = progression.getIdentifier(i+1);
if (i != progression.size() - 1) {
parent.appendInfo(nextSymbolID + " to " + currentSymbolID + " = ");
} else {
parent.appendInfo(currentSymbolID + " = ");
}
backupVector[i] = new ArrayList<Chord>();
//get the starting note
startingNote = getStartingNote(currentSymbolID);
//get all the possible notes for that chord
fullSpectrum[i] = new ChordTemplate();
fullSpectrum[i] = createChord(currentSymbolID,
startingNote,
fullSpectrum[i]);
//get all possible combinations of that chord (and doublings)
Chord allChords[] = createAllChords(fullSpectrum[i],
currentSymbolID);
parent.appendInfo(allChords.length + " number of doublings, ");
if (i != progression.size() - 1) {
allChords = checkMotion(allChords, chordArray[i + 1]);
parent.appendInfo(allChords.length + " correct motions");
parent.appendInfo("\r\n");
}
if (allChords.length != 0) {
//if the very last chord...
if (i != progression.size() - 1) {
chordArray[i] = compareChords(allChords, chordArray[i + 1]);
} else {
//create prefered last chord (For cadence)
Voice bassVoice = new Voice(NotePosition.ROOT, new Note("C2"));
Voice tenorVoice = new Voice(NotePosition.FIFTH, new Note("G2"));
Voice altoVoice = new Voice(NotePosition.THIRD, new Note("E3"));
Voice sopranoVoice = new Voice(NotePosition.ROOT, new Note("C4"));
//if the last chord is I....
if (progression.getIdentifier(i).equals("I")) {
chordArray[i] = new Chord("I", bassVoice, tenorVoice, altoVoice, sopranoVoice);
parent.appendInfo("\r\n");
} else {
chordArray[i] = compareChords(allChords,new Chord("I", bassVoice, tenorVoice, altoVoice, sopranoVoice));
parent.appendInfo("\r\n");
}
}
for (int j = 0; j < allChords.length; j++)