Languages

You are here

Music generator

The purpose of this software is to create various music phrases. The software is capable of producing both melodies as well as chord progressions. This software assumes user participation. The user evaluates each phrase which influences the next generation of phrases that the software produces. The user can evolve the phrases until the results become satisfying.

To launch the application choose a language using the buttons below:

User interface

The user interface consists of two sections. The first section contains all of the parameters that the software uses. The second section consists of generated phrases that can be played, scored and downloaded in midi format.

Parameters

Population size – number of phrases in a population

Mutation chance – the probability of a random mutation occurring when generating a phrase in the next generation

Tempo – the tempo of phrases (in other words, this parameter controls the playback speed)

Chord complexity – the harmonic complexity of the generated chords

Min. note length – minimum length of notes occurring within a phrase

Max. note length – maximum length of notes occurring within a phrase

No. of notes in a chord – number of notes that can occur in one given time moment, setting this parameter to 1 results in melodies being generated instead of chords

Phrase length – the length of generated phrases

There are two buttons that the user can click: RESTART and NEXT GENERATION:

RESTART – regenerates the initial generation of phrases

NEXT GENERATION – generates the next generation of phrases

Phrases

The phrases are presented as midi. By clicking the buttons on a given phrase the user can increase or decrease the phrase's score as well as just play the phrase . In top left corner of a given phrase there is a button that lets the user download the phrase in midi format.

How to use

First, you can adjust all of the parameters. The default values should provide some interesting results, but you can initially decrease the number of notes in a chord. Next, you should listen to the phrases and evaluate them using the arrow buttons on each of the phrases. After evaluating the phrases, click the NEXT GENERATION button. This process should be repeated until the results are interesting, inspiring or satisfying.

Technical part

First generation

The first generation of phrases is generated randomly. Firt, the rhythm of a phrase is generated. It is generated by picking a random length from an array of predefined note lengths. The rhythm generation is controlled by Min. note length and Max. note length parameters. The sum of all the lengths that the rhythm consists of is equal Phrase length. Then the scale is chosen. For every length in the rhythm array a base note is randomly chosen. From that base note a chord is constructed. The chords are constructed from a predefined array of intervals. The number of notes in a chord is controlled by the Number of Notes parameter while the harmonic complexity of the chords are controlled by the Chord complexity parameter.

Subsequent generations

Evaluation

The process of generating the subsequent generations starts with evaluating each phrase. A phrase can be awarded a score number ranging from 0 to 10. Each phrase starts with a score of 1. Setting the score to 0 will result in banning a phrase from influencing the next generation.

Selection

The population of a subsequent generation is created through recombination of genes from two specimens and random mutations. Specimen selection is done using the roulette wheel selection.

Crossover

The crossover process starts with choosing a common scale to which both parents are transposed. Then a rhythm of the offspring is constructed using the beginnings and end of the notes from both parents. For every length that the new rhythm consists of a pool of notes that exists at a given time grain are gathered. From that pool a base note is randomly chosen for every length in the offspring's rhythm. From that base note a chord is constructed using the same process as the first generation of phrases. The only difference is that the harmonies are chosen from the same pool of notes from which the base notes were chosen. The complexity of the chord is still controlled by the Chord complexity parameter.

Mutations

The mutation chance is set by the Mutation chance parameter. In this software 3 types of mutations exist:

Scale mutation – transposition of phrase by one semitone up or down.

Rhythm mutation – cutting a chord and inserting a new one or joining two chords together.

Melody mutation – deleting a chord and inserting a new one in its place.

Program and text: Łukasz Grygier
Mentor: Maciej Komosinski


An alternative, older implementation of this idea in java is here.