GeneticSharp in the Wild: Procedural Music Generation

I started a series of posts about some outstanding scientific papers and projects using GeneticSharp.

For this fifth post the chosen one is the State of the Art in Procedural Music Generation using Genetic Algorithms and Rule Based GA Implementation with Attractor Waves.

Introduction

The act of composing a piece of music in regarded as a creative process which encompasses objective and subjective rules. Objective rules can be pointed as the minimum necessary ones so that a given composition is considered structurally valid – music theory. Subjective rules depend on the composer ability to make a creation that is pleasant to the majority of the human listeners – or at least an intended specific audience.

Usage

Given that the creation process uses the human composer’s experience and sensibility – which in some form is an unknown rule set – it is assumed by some authors that, by analyzing the characteristics of the produced pieces of music spanning from several composers, underlying rules can be inferred.

Genetic algorithms will make the evolution of data encoded in a structure analogous to the chromosome. Traditionally, this piece of information is represented as a binary base, but it is not restricted to 2 symbols, as long as the needed processes for the evolution can be applied.

For the fitness function, we will use music theory as done in many previous papers, penalizing notes that are outside the chosen scale and giving bonus to those that match.

post image


Results

To understand in a first approach, what rating values were most fitting, a first tryout was made by translating the start of some classical pieces into the chromosome output structure. This ideal output was then rated by the fitness algorithm. By obtaining each individual rating component for each tested sample, it was possible to predefine a start set of values to be used. The exception was the attractor wave, which was set subjectively. Using two attraction waves, it is possible to visualize intended effect. In proximity with the wave, the notes fall into its attraction basin. When two waves are near, the effect either oscillates between the two or compromises during their proximity. Overall, many of the generated compositions have a subjective pleasant tone to them.

Sample generated music

You can listen a sample music generated by the genetic algorithm:

Author

Rui Luz and Rafael Silva wrote the paper for Instituto Politécnico do Cávado e do Ave, Barcelos, Braga, Portugal.

Further reading

You can access the full paper directly on project’s Github repository.

Loading comments...
Tutorials

Articles

Labs