geneseq
A genetic algorithm melody generator/sequencer for Max/MSP (Max external).
This Max external object implements a genetic algorithm for simple 8 step melodies using scale degrees. Given a target melody, evolve a population of candidate sequences and choose the best one for each generation. See the GitHub project’s README for a fuller description.
It was inspired by the Generative sequencers thread, specifically the post by @karol on describing a genetic algorithm for drum gates and the Genetic algorithm based drum sequencer for max4live. Additional inspiration is based on the use of genetic algorithms for guessing random strings of text, which could be used to represent a simple series of notes/scale degrees.
The motivation is to add cyclical variation to a melody that moves along a scale from random to intentional. A simple musical phrase is chosen. Successive iterations of sequences try to resolve towards it. With each cycle of these sequences evolving/resolving to the intended phrase, the cycle starts out feeling random but in a relatively short number of iterations becomes close to the target melody and eventually results in the target melody.
I am sharing this prototype here simply as a way to contribute some work back to the discussion referenced above that was a very big influence. I stumbled across the Lines thread at the same time I took my first foray into Max external development. As is probably evident, this is the work of someone very new to both C programming and developing Max externals.
For anyone interested in taking it for a spin, any/all constructive feedback is welcome. Feel free to say the C code stinks if you have any pointers (pun intended). Feel free to let me know if this could be improved from an idiomatic Max perspective (e.g., the design of messages and input, output and outlet choices).
Future enhancements may include more flexible configuration of default parameters.
Requirements
- Max 8
- Building a Max external from source
Documentation
See the GitHub README for geneseq and Example Patches once it is built.
Download
Clone from:
Build from source using the Max SDK.
See the quick steps provided by @jojjjajjr below.