“Effective search methods become, when the search space is sufficiently large, indistinguishable from true creativity” — Richard Dawkins
Update — Genesynth featured on the Cycling’74 website!
geneSynth intended to explore multi-agent control, genetic algorithms, interactivity in music and the simulation of autonomous flocks or ‘agents’. It was designed to perform as a standalone generative system, or with a human musician as an interactive musical companion, producing evolving ambient music. It was inspired by philosophical and scientific ideas like meta-physics, gene sequences and the ancient Indo-Greek five element theories.
geneSynth was envisioned as self-contained performer, with all the physical simulations, communications and sound generation modules integrated. However, in this version (1.1b), the program outputs MIDI and uses VST instruments to produce sound. It uses two core programs, Processing for the simulation of the flock, and Cycling 74’s Max/MSP for the genetic algorithm. The programs communicate over OSC, and therefore can be run on separate computers if desired. A Digital Audio Workstation (DAW) with VST instruments is used to generate sound.
The heart of geneSynth lies in the simulation of the flock of agents, using the Boids algorithm by Craig Reynolds. A Processing port (by Daniel Schiffman) of the popular Box-2D physics engine is used for the physics simulations. A microcosmic world is simulated top-down, with finite boundaries and the five ‘elements’: earth, fire, air, water and the surrounding aether. A flock of triangular, mortal ‘agents’ reside in this world, whose sole purpose is to feed on the ‘ambrosia’ that periodically appears in random locations, giving them a short boost of life. When their life eventually runs out, they die, and their genetic offspring replace them in the world.
During their lifetime, the ‘agents’ seek the ambrosia, along with other agents in the ‘flock’. The behavior and dynamics of the flock is governed by three parameters which control the separation, alignment and cohesion of the agents in the flock. A great pictorial representation of these behaviors can be found at Craig Reynold’s website. I’ve included a slightly modified version below. The three adjustable parameters control the relative position of the agents, which effects the final musical output (more on this later).
Each individual ‘agent’ has a different mass and density, which modifies how quickly they can react to external stimuli and how fast can move (pictured below). It also has its own radial ‘field of view’, beyond which it cannot sense the ‘ambrosia’. If an agent can sense ambrosia, it moves towards the closest source, accelerating to a maximum speed and slowing down as it approaches, adhering to the behavior of the flock.
The world was envisioned to be made up of five elements: earth, fire, wind, water and aether, which possess different physical properties and impose unique restrictions on the agent. The elements can be positioned beforehand, different such arrangements can produce varied final results. The aether, represented in white is assumed to be the material that contains all the other elements inside of it, filling the world and imposing basic behaviors on the system. Earth is represented by a brown, impenetrable object, which the ‘agent’ has to navigate around. Water, represented by blue, slows the agent down, but not enough to stop it completely. Fire, represented by red, entraps the agent and also drains its life faster than normal. Once in, an agent cannot escape fire, except in some rare, unusual circumstances where the laws of physics are broken. Wind, depicted in grey, exerts a directional force on the ‘agent’, forcing it to change its direction. The direction of the wind changes at random, making it the only element to have unpredictable behavior. To make matters interesting, the agents are not intelligent enough to avoid these elements, but run into them if they are in the path.
Every agent is identified by a musical note, which is made to drone throughout its lifetime, its contribution to the world. The selection of notes is controlled by a generic algorithm, which in turn can be controlled by a human musician. A rudimentary key detection algorithm detects the key the user is playing in, out of an arbitrary selection of three scales representing angry, mysterious and serene moods. If a change in key is detected and sustained for over 2 seconds, the genetic algorithm is directed to a new solution (the key the musician is playing). The algorithm is ‘slowed’ down to produce interesting consonant and dissonant intervals along the way; the progeny bear notes of the new scale (and those created by mutations and crossovers), and the drone evolves.
One immortal agent is also present in the system, but unlike mythology (and rather anticlimactically), the agent lives, feeds and behaves just like all the other animals in the system. The immortal agent never dies, and can walk on water and through fire. The Immortal forms the center of a sonification method, when activated, generates a momentary ‘force field’ through the world. It now ‘knows’ the presence of every other living agent (by its note) and its distance, and maps this data into MIDI pitch and velocity for the sonification. The distances and relative position of the agents depend largely on the aforementioned three flocking parameters, which effect the final musical output of this sonification method.
The output of the force-field sonification is compelling — a phrase rarely repeats. Permutations of phrases can be heard as the agents move around, notes are constantly added and removed from the phrase as agents are created and destroyed. The intervals between the notes within a phrase are chosen by a ‘random walk’ algorithm, and a phrase is generated at regular intervals.
Independently, the human musician also controls the physical simulation. The pitch and velocity of the musician’s instrument (in my case, an electric guitar played with an EBow) is scaled and mapped to span the world in a grid-like system, the exact coordinate is visualized by a red circle. Ambrosia is created at the center of this circle at random intervals, giving the human musician meta-control over the location of the agents.
geneSynth offers a lot of parameters for control. The position of the elements in the world can be arranged, the densities and life span of the agents can be modified, the rates of creation of ambrosia and the agents can be altered, the group dynamics and genetic algorithm offers many more possibilities, each with potentially different musical outcomes.Tags: 2013, DSP, Genetic Algorithms, Georgia Tech, Max, Music, OSC, Pitch Detection, Processing