Our Program
We have created an algorithm specifically for interactive algorithmic music composition – a program where the user defines a set of parameters such as the number of notes in their song, a set of songs that the user wishes the program to compose in the style of, and the seed for the song. Once the user is happy with what they have input, the algorithm generates a song based on the user’s input
Markov chains are a way of determining the future state of a system based on a framing of the probabilities of specific transitions based on the current state of the system (1st order markov chain) or based on the current state as well as previous states (nth order markov chain).
To build a markov chain, a training set is broken down into a sort of histogram containing information about the number of times each possible transition takes place within the training set. From this information, it is possible to derive the probabilities of each transition given an initial state or ‘seed’.
In the context of algorithmic music composition, we use markov chains to develop the rhythms and notes of the melody of a song. Our training set is in the form of musicXML files of various musical works which our algorithm parses and stores as a dictionary where the keys are the ‘seeds’ and the values are a list of all transitions (including repeated transitions).
To actually generate a song from this information, our algorithm accepts the first note as input from the user. If the user wishes to use markov chains higher than first order, the algorithm randomly selects the other notes in the seed. It then uses this seed as a key and searches the markov dictionary for this key. If the key does not appear in the dictionary, a random output note is selected to allow the program to continue. If the key appears in the dictionary, the algorithm randomly selects an output state from the list of possible output states. Because repeated transitions are included in that list, the probabilities of each transition are preserved.
The same process is followed for selecting the rhythm of the piece except that currently due to constraints within the Graphical User Interface, the program does not accept a seed for the rhythm markov chain. Instead, the program automatically uses half notes as the seed for the rhythm.
Authors and Contributors
We are Joseph Lee and Bryan Werth, two freshman at Olin College of Engineering.