Music Soft->Windows->Automated Composing System

I received some e-mails that asked how the Automated Composing System works. So, let me explain more detail of the algorithm. However, I will not explain general matters, such as file creation and MIDI device control.

Outline
The Automated Composing System composes a tune with 5 steps. 

(1) Creating an Outline 
(2) Creating a Chord Progression 
(3) Creating a Harmony track and Rhythm track 
(4) Creating Melody tracks 
(5) Coordination of tracks 

(3) and (4) are reversible in order.
Creating the Outline
Most music tunes have patternized structure. For example, a rock tune has an introduction, several themes (phrases of about 2 to 4 measures), and an ending. As the first step, the outline of the tune is created using random numbers. 
The Automated Composing System does not have an introduction part. Therefore, the number of themes and how many times they are repeated have to be determined from random numbers. The last theme and the ending always have the same structure. 

For example, outline is like [theme-A] [theme-A] [theme-B] [theme-B] [theme-B] [last-theme] [ending]. The shortest outline is  [theme-A] [last-theme] [ending].
Creating the Chord Progression
In this step, the chord progression of the tune and length of each measure will be determined using the outline. 
The Automated Composing System uses chords that consist of four notes. For example, C7 contains C, E, G, Bb. The Automated Composing System does not use chords that consist of five notes, such as C9. Notes after 9th note are used as tension notes. The system uses sus4 note, but it always goes to major 3rd note quickly. 
The first chord of the tune must be CM7, Am7, C7. If the major key is selected, the first chord is CM7, if the minor key is selected, the first chord is Am7, and if the tune is Blues, the first chord is C7. Chords after the first chord are determined from the prior chord and a database. The different chord is selected depending on the setting of chord progression such as "complex" and "simple." For the last theme, a different database is used because it needs resolution. The ending chord is always the same chord as the first chord. 
The length of each measure is determined using random numbers, and they will be from one to eight times of quarter note length.

For example, [CM7 of whole note length] [Em7 of whole note length] [Am7 of half note length] [G7 of half note length] are assigned to [theme-A].
Creating the Harmony track and the Rhythm track
In this step, the harmony and the rhythm tracks are created using the determined chord progression. 
The generation process of the Harmony track is very complicated since each music style has a different pattern. Although a typical pattern is prepared to use, rhythm and notes are modified to avoid a monotonous sound. For example, the Harmony track includes tension notes if it is for jazz music. 
The Rhythm track is very patternized. Although, it uses simple patterns, it may contain fill-ins occasionally.
Creating Melody Tracks
Melody tracks are also created based on chord progression. In this process, the contents of the Harmony track and the Rhythm track are not referred to. 
Each theme is processed at a time. First, a line is determined for the theme using Lagrange polynomial. It is easy to understand if you imagine a music score and drawing a line on it. For example, if [theme-A] contains 4 measures, a line of 4 measure length will be drawn on the score. This can be done using Lagrange polynomial and random numbers.
Next, the rhythm of the melody line is determined. For example, a combination of 2 eighth notes and 3 quarter notes fills a measure.
Assigning the rhythm into the Lagrange polynomial makes a melody line. However, this melody line is only temporary.
The temporary melody line includes notes that are not on the music scale. Notes that are not on the music scale and dissonant notes to the chord will be adjusted using another database. Dissonant notes can be changed into consonant notes if they are shifted a half note above or shifted a half note down.
This process is repeated if there is more than one melody track. The Sub-Drum track is also created using this routine internally.
Coordination of tracks
Finally, dissonants, such as minor 2nd and major 2nd, between melody tracks and harmony tracks are deleted. For some music style, such as Jazz, that allows disonant, this process may not be necessary.