As there are many resources available to teach music theory, I won't attempt to give very much detail here. This discussion will be confined to the specifics of how MusicCreator works.
The experienced composer will find the method used by MusicCreator to be very limited. This I don't deny. My excuse is that I only had one semester in which to produce a working program. There simply wasn't time to make the algorithm more complicated. However, I think the algorithm we have works remarkably well.
MusicCreator defines available chords by reading them from an XML file with a ".mcx" extension. The XML has the following structure:
MusicCreatorDefinitions: the root element
ChordGroup: a group of chords within a common grouping. MusicCreator treats every chord in each group as musically equivalent. Each ChordGroup contains a single attribute, "groupnum", an integer.
ChordDefs: the musical definitions of the chords.
ChordDef: a single chord definition
Name: the musical name of the chord, such as "I" or "ii"Notes: the group of notes contained in each chord.
Note: a single note in a chord. This is a singleton element containing a single attribute, "step", which is an integer defining the position of the note, in half-steps, from the root of the key. For example, in the key of C, is the note "C", and is the note E-flat/D-sharp.Diatonic: a boolean value indicating that the chord is diatonic to the key. Each chordgroup must contain at least one diatonic chord, or the program could go into an infinite loop when "use only diatonic chords" is selected.
Progressions: the group of possible progressions for each ChordGroup
Progression: a single progression for a ChordGroup
Percentage: the chance a progression has of being picked. The sum of all progressions for a single ChordGroup must equal 100.CanComeFromList: the list of ChordGroups that can preceed this ChordGroup.
CanComeFrom: An integer representing the groupnum for another ChordGroup. A progression consists of each of these elements in order.The following XML is used in the chord file to define the tonic chord:
<chordgroup groupnum="0">
<ChordDefs>
<ChordDef>
<name>I</name>
<notes>
<note step="0"/>
<note step="4"/>
<note step="7"/>
</notes>
<diatonic>true</diatonic>
</ChordDef>
</ChordDefs>
<Progressions>
<progression>
<percentage>80</percentage>
<canComeFromList>
<canComeFrom>1</canComeFrom>
</canComeFromList>
</progression>
<progression>
<percentage>20</percentage>
<canComeFromList>
<canComeFrom>5</canComeFrom>
</canComeFromList>
</progression>
</Progressions>
</chordgroup>
This is the definition of group "0" (indicated by the groupnum attribute), the "tonic" group of chords. There is only one chord definition in the group, with name "I". The definition of the chord shows that it contains notes 0, 4, and 7 of the key. The chord is diatonic to the key.
This chordgroup has two progressions. The first has an 80% chance of being picked. It consists of the single group "1". I.e., this chordgroup may be preceded by any chords in group 1. Similarly, the second progression shows that chordgroup 0 can be preceded by a chord in group 5.
In order to simplify processing, MusicCreator groups chords into "equivalency groups." These are groups of chords that essentially act the same. For example, V and V7 generally act the same (i.e., they usually preceed I, and sometimes vi), so they are grouped together. Similarly, ii, ii6, ii7, ii65, II, and II7 generally preceed V, so they are grouped together.
When generating a piece of music, MusicCreator generates a list of groups first, and then randomly selects a chord from each group. This has been known to produce surprising results, for which I blame my own lack of foresight in designing the groupings. Eventually I would like to do away with this concept of groups and have each chord listed separately, but this would vastly increase the size of the "progression" file (see below), as each chord would have to have its own "progression tree".