I've created some pseudocode for some software that is supposed to compose music independently, given a specific musical time period. This particular algorithm is supposed to create a medieval song, help regarding how to make it more accurate to the medieval time period (circa. 500 to 1400).
I'm also going to put this on code review but I figured that this site would be better regarding the musical side of things ^_^
Set Time signature to 6:8
Set tempo to a random number between 60 and 75 bpm
Set dynamics interval (the amount of bars to wait until changing dynamics) to a random multiple of 2 between 4 and 12.
Set Dynamics to forte
Set number of bars to a random multiple of 4 between 16 and 32.
For each dynamic interval
Set the dynamics either one step louder (e.g. from forte to fortissimo) or one step quieter (e.g. from forte to mezzo forte).
Set key signature to any key signature whose sharps and flats are less than 4 (e.g. A major).
Create random chord sequence based on key signature (e.g. A, D, For the first bar:
Add a dotted minim with a random note of the chord (e.g. either A, C#, or E from A major).
Create a random pattern for half the bar (mostly either three quavers or a crotchet and a quaver) using random notes from the key signature.
Create another random pattern for the second half of the bar (preferably different from the first half)
For the rest of the bars except for the last:
Add a dotted minim with a random note of the chord (e.g. either A, C#, or E from A major).
Create random notes using the same rhythm pattern for both halves of the first bar.
For the last bar:
Add a dotted minim for each note of the final chord.