I’ve built programs that create dynamically generated music in two different ways:

Dynamic Loops
This program puts together various pre-recorded loops and splice them together randomly. My thought was that with a small palette of music assets, you could build an exponentially larger canvas of music.
There are 7 songs that play in this file.

Random Music Generator A
This program (and the one below) are an attempt to build music where the actual choice of notes is random, rather than a pre-written loop. This one addresses one portion of the problem of the problem – the issue of having two ‘instruments’ playing at once, but only one short phrase at a time.

The second program below attacks the issue of having multiple phrases arranged into sections.

Random Music Generator B
You need to refresh the page to make the program write a new piece – an issue that I may resolve at some juncture in the future.