Algorithmic Composition

MPS features an algorithmic composition system which generates music based on statistical criteria.

Generating Compositions

To start generating a composition, it is recommended to create a new folder by right-clicking on a project and selecting NewFolder.

Next, select the created folder and click on the algorithmic composition button:

Algorithmic Composition Launch Configurations

A launch configuration will be created and opened automatically:

Here you can enter the desired number of measures, number of voices and the instruments that should be used in the composition. If you don’t specify any instruments here, instruments will be selected randomly.

Furthermore, parameters for the evolutionary algorithm can be adjusted. It is recommended to use a high crossover rate and a low mutation rate in order to prevent the algorithm from converging too early on local optima (as opposed to global optima, which are preferable). Adjusting the number of generations, the population size or the number of offspring will influence the time the algorithm takes to run. However, if these values are set too low, the evolutionary algorithm might not be able to satisfy all optimization criteria.

Composer launch configurations can be reused, edited and deleted at any time. Refer to section Launch Configurations for further details.

Fitness Function Configuration

The statistical criteria to be fulfilled are specified by means of a so called fitness function. The fitness function can contain statistical criteria on a global level and multiple subsidiary levels. Each musical piece to be generated is divided into an arbitrary number of sections, which in turn contain individual voices. It is possible to specify musical criteria for the whole piece (global level), for individual sections (section level) and for each voice in each section (voice or stream level).

Note that the fitness function configuration must be performed at least once. Otherwise, the evolutionary algorithm can not be run.

Open the fitness function configuration dialog by clicking the button Open Fitness Function Configuration in the algorithmic composition launch configuration:

The user interface allows to add, edit and remove fitness functions on the global level, section level and voice/stream level. The fitness function must contain at least one section and one voice per section. In the example above, there is a global fitness function aiming for an overall note density of 90%, as well as a section with one voice in which the distribution of note durations is optimized.

The fitness function configuration will be stored in a file named FitnessFunctionConfiguration.ff in the specified base directory for the generated composition.

Creating Fitness Functions by Importing Analysis Results

The fitness function configuration dialog offers a button labeled Import Distributions from CSV files which allows to construct fitness functions from MPS analysis results. Generating compositions that have imported statistical values as target fitness function will effectively result in a style copy of the analyzed compositions. Note that not all statistical features can automatically be converted into a fitness function. Refer to chapter Music Analysis for more details on analysis features.

Generating Compositions Algorithmically

After configuring an algorithmic composition run, click the Run button in the launch configuration dialog. Progress will be reported in the corresponding Progress view, which is located at the bottom of the application by default. Depending on your configuration, evolutionary algorithm runs might take quite a long time. The results will be saved in a subdirectory named ComposerResults in the specified base directory for the generated composition. The resulting composition file is named SectionWiseComposition.mcl and can be converted into a score and/or MIDI file as described in section Transforming Compositions to Scores.

Composition Crossover

Composition crossover combines musical material of an arbitrary number of compositions to a new composition. This is achieved by recombining context tree composition models using the evolutionary algorithm described before. The algorithm is configured with a very high crossover rate (close or equal to 100%) and uses an automatically generated fitness function which optimizes the resulting context tree model to contain about the same ratio of tree nodes from each input composition.

To start a composition crossover run, select at least two compositions in your workspace:

Open the context menu with a right click and select Run AsMPS Composition Crossover:

A launch configuration will automatically be created and the following dialog appears:

Specify the desired number of measures and voices. It is recommended to use a very high crossover rate and a very low mutation rate. Adjusting the number of generations, the population size and the number of offspring influences the time the algorithm takes to run. However, if these values are set too low, the evolutionary algorithm might not be able to satisfy all optimization criteria.

Crossover launch configurations can be reused, edited and deleted at any time. Refer to section Launch Configurations for further details.