Looking for evolutionary music example code [closed]

I would like to implement an interactive evolutionary algorithm for generating music (probably just simple melodies to start with).

I'd like to use JFugue for this. Its website claims that it is well-suited to evolutionary music, but I can't find any evolutionary examples.

I already have a framework to provide the evolutonary machinery. What I am looking for is some simple, working code that demonstrates viable approaches for the musical part (e.g. suitable encodings and evolutionary operators for the evolved tunes).

I have some ideas how it might be achieved, but I'm not particularly knowledgeable about music theory, so to start with I'd like to just reimplement something that is known to work.

So does anybody have, or know of, any freely available code (any language is fine) that demonstrates one or more approaches to evolutionary music?

EDIT: I'm specifically looking for evolutionary code rather than other techniques that could be used for music synthesis.

Asked by: Agata337 | Posted: 23-01-2022

Answer 1

You probably want to look into Markov Chains - They're probably of more use to you than an evolutionary algorithm to start with, as judging the quality of the output in order to breed the best is going to be a nightmare (subjective and time-consuming), and they're ideal for combining with evolutionary programming.

There's a good introduction to them on Coding Horror. The article explains the concept and demonstrates the remarkable results, the comments mention music a lot more (I was lost for hours in the comments and the sites they linked to). There's some more specific details and further reading on Wikipedia.

Markov chains have an element of probability to them, so this is where you can combine them with evolutionary programming - by evolving a method of choosing alternatives other than the roll of a dice.

Answered by: Daniel851 | Posted: 24-02-2022

Answer 2

So far I've found only this, which is a genetic programming example in C.

Update (January 2010): And this online system, which doesn't have source code but is an example of what can be achieved. I also found Grammidity, which allows for sequences of MIDI events to be evolved from grammars.

Update (July 2011): I've just found some relevant Python code on the MIT Open Courseware site.

Answered by: Chelsea920 | Posted: 24-02-2022

Answer 3

There is some research going into using Cellular Automata for generating music. As with all other music generation, it is really a question of mapping rather than generation. You could use pretty much anything as input as long as you define your mapping so that it sound "good" (well I guess interesting is a better word).

Googling "cellular automata music" gives quite a few hits. Another good source for information is the Computer Music Journal if you can get access to their archives.

Answered by: Aston680 | Posted: 24-02-2022

Similar questions

java - Converting an evolutionary algorithm to genetic

From what I can tell one of the biggest differences between evolutionary and genetic algorithms is that evolutionary employs a mutate function to generate a new population while a genetic used a crossover function. I found an evolutionary algorithm that trys to generate a target string through mutations like this: ...

string - Clarifying Java's evolutionary support of Unicode

Closed. This question is opinion-based. It is not c...

Annotating tree nodes with data for analysis with the Java Evolutionary Biology Library (JEBL)

I'm using JEBL and am stumbling along with the API as I can't find very clear documentation or examples anywhere. What I would like to do is read in a tree with branches annotated with lengths and nodes annotated too. I should then be able to get the leaves and traverse the tree upwards, checking the annotations of the nodes as I go (the traversal is easy en...

evolutionary algorithm - Gene expression programming [Java]: How to view the members of the population

I'm using a gene expression programming library demo to obtain alternative mathematical expressions. I downloaded all the class files for uncommons.watchmaker framework and created a new project that runs without jar files. Java Project (full source code) i...

Still can't find your answer? Check out these amazing Java communities for help...

Java Reddit Community | Java Help Reddit Community | Dev.to Java Community | Java Discord | Java Programmers (Facebook) | Java developers (Facebook)