geneSynth

“Effec­tive search meth­ods become, when the search space is suf­fi­ciently large, indis­tin­guish­able from true cre­ativ­ity” — Richard Dawkins

Update — Genesynth fea­tured on the Cycling’74 web­site!

geneSynth intended to explore multi-agent con­trol, genetic algo­rithms, inter­ac­tiv­ity in music and the sim­u­la­tion of autonomous flocks or ‘agents’. It was designed to per­form as a stand­alone gen­er­a­tive sys­tem, or with a human musi­cian as an inter­ac­tive musi­cal com­pan­ion, pro­duc­ing evolv­ing ambi­ent music. It was inspired by philo­soph­i­cal and sci­en­tific ideas like meta-physics, gene sequences and the ancient Indo-Greek five ele­ment theories.

geneSynth was envi­sioned as self-contained per­former, with all the phys­i­cal sim­u­la­tions, com­mu­ni­ca­tions and sound gen­er­a­tion mod­ules inte­grated. How­ever, in this ver­sion (1.1b), the pro­gram out­puts MIDI and uses VST instru­ments to pro­duce sound. It uses two core pro­grams, Pro­cess­ing for the sim­u­la­tion of the flock, and Cycling 74’s Max/MSP for the genetic algo­rithm. The pro­grams com­mu­ni­cate over OSC, and there­fore can be run on sep­a­rate com­put­ers if desired. A Dig­i­tal Audio Work­sta­tion (DAW) with VST instru­ments is used to gen­er­ate sound.

The heart of geneSynth lies in the sim­u­la­tion of the flock of agents, using the Boids algo­rithm by Craig Reynolds. A Pro­cess­ing port (by Daniel Schiff­man) of the pop­u­lar Box-2D physics engine is used for the physics sim­u­la­tions. A micro­cos­mic world is sim­u­lated top-down, with finite bound­aries and the five ‘ele­ments’: earth, fire, air, water and the sur­round­ing aether. A flock of tri­an­gu­lar, mor­tal ‘agents’ reside in this world, whose sole pur­pose is to feed on the ‘ambrosia’ that peri­od­i­cally appears in ran­dom loca­tions, giv­ing them a short boost of life. When their life even­tu­ally runs out, they die, and their genetic off­spring replace them in the world.

geneSynth

Agent (tri­an­gle) seek­ing Ambrosia (yel­low circle)

Dur­ing their life­time, the ‘agents’ seek the ambrosia, along with other agents in the ‘flock’. The behav­ior and dynam­ics of the flock is gov­erned by three para­me­ters which con­trol the sep­a­ra­tion, align­ment and cohe­sion of the agents in the flock. A great pic­to­r­ial rep­re­sen­ta­tion of these behav­iors can be found at Craig Reynold’s web­site. I’ve included a slightly mod­i­fied ver­sion below. The three adjustable para­me­ters con­trol the rel­a­tive posi­tion of the agents, which effects the final musi­cal out­put (more on this later).

Separation: Steer to avoid crowding local flockmates

Sep­a­ra­tion: Steer to avoid crowd­ing local flockmates

Alignment: Steer towards the average heading of local flockmates

Align­ment: Steer towards the aver­age head­ing of local flockmates

Cohesion: Steer to move toward the average position of local flockmates

Cohe­sion: Steer to move toward the aver­age posi­tion of local flockmates

Each indi­vid­ual ‘agent’ has a dif­fer­ent mass and den­sity, which mod­i­fies how quickly they can react to exter­nal stim­uli and how fast can move (pic­tured below). It also has its own radial ‘field of view’, beyond which it can­not sense the ‘ambrosia’. If an agent can sense ambrosia, it moves towards the clos­est source, accel­er­at­ing to a max­i­mum speed and slow­ing down as it approaches, adher­ing to the behav­ior of the flock.

2

Agents col­ored darker are more ‘dense’, and can­not move about and react as quickly as the lighter ones.

The world was envi­sioned to be made up of five ele­ments: earth, fire, wind, water and aether, which pos­sess dif­fer­ent phys­i­cal prop­er­ties and impose unique restric­tions on the agent. The ele­ments can be posi­tioned before­hand, dif­fer­ent such arrange­ments can pro­duce var­ied final results. The aether, rep­re­sented in white is assumed to be the mate­r­ial that con­tains all the other ele­ments inside of it, fill­ing the world and impos­ing basic behav­iors on the sys­tem. Earth is rep­re­sented by a brown, impen­e­tra­ble object, which the ‘agent’ has to nav­i­gate around. Water, rep­re­sented by blue, slows the agent down, but not enough to stop it com­pletely. Fire, rep­re­sented by red, entraps the agent and also drains its life faster than nor­mal. Once in, an agent can­not escape fire, except in some rare, unusual cir­cum­stances where the laws of physics are bro­ken. Wind, depicted in grey, exerts a direc­tional force on the ‘agent’, forc­ing it to change its direc­tion. The direc­tion of the wind changes at ran­dom, mak­ing it the only ele­ment to have unpre­dictable behav­ior. To make mat­ters inter­est­ing, the agents are not intel­li­gent enough to avoid these ele­ments, but run into them if they are in the path.

4

The World, show­ing the five elements

Every agent is iden­ti­fied by a musi­cal note, which is made to drone through­out its life­time, its con­tri­bu­tion to the world. The selec­tion of notes is con­trolled by a generic algo­rithm, which in turn can be con­trolled by a human musi­cian. A rudi­men­tary key detec­tion algo­rithm detects the key the user is play­ing in, out of an arbi­trary selec­tion of three scales rep­re­sent­ing angry, mys­te­ri­ous and serene moods. If a change in key is detected and sus­tained for over 2 sec­onds, the genetic algo­rithm is directed to a new solu­tion (the key the musi­cian is play­ing). The algo­rithm is ‘slowed’ down to pro­duce inter­est­ing con­so­nant and dis­so­nant inter­vals along the way; the prog­eny bear notes of the new scale (and those cre­ated by muta­tions and crossovers), and the drone evolves.

One immor­tal agent is also present in the sys­tem, but unlike mythol­ogy (and rather anti­cli­mac­ti­cally), the agent lives, feeds and behaves just like all the other ani­mals in the sys­tem. The immor­tal agent never dies, and can walk on water and through fire. The Immor­tal forms the cen­ter of a soni­fi­ca­tion method, when acti­vated, gen­er­ates a momen­tary ‘force field’ through the world. It now ‘knows’ the pres­ence of every other liv­ing agent (by its note) and its dis­tance, and maps this data into MIDI pitch and veloc­ity for the soni­fi­ca­tion. The dis­tances and rel­a­tive posi­tion of the agents depend largely on the afore­men­tioned three flock­ing para­me­ters, which effect the final musi­cal out­put of this soni­fi­ca­tion method.

3

The Immor­tal Agent, iden­ti­fied by a blue cir­cle at its center.

The out­put of the force-field soni­fi­ca­tion is com­pelling — a phrase rarely repeats. Per­mu­ta­tions of phrases can be heard as the agents move around, notes are con­stantly added and removed from the phrase as agents are cre­ated and destroyed. The inter­vals between the notes within a phrase are cho­sen by a ‘ran­dom walk’ algo­rithm, and a phrase is gen­er­ated at reg­u­lar intervals.

Inde­pen­dently, the human musi­cian also con­trols the phys­i­cal sim­u­la­tion. The pitch and veloc­ity of the musician’s instru­ment (in my case, an elec­tric gui­tar played with an EBow) is scaled and mapped to span the world in a grid-like sys­tem, the exact coor­di­nate is visu­al­ized by a red cir­cle. Ambrosia is cre­ated at the cen­ter of this cir­cle at ran­dom inter­vals, giv­ing the human musi­cian meta-control over the loca­tion of the agents.

5

The Cir­cle, where ambrosia is created

geneSynth offers a lot of para­me­ters for con­trol. The posi­tion of the ele­ments in the world can be arranged, the den­si­ties  and life span of the agents can be mod­i­fied, the rates of cre­ation of ambrosia and the agents can be altered, the group dynam­ics and genetic algo­rithm offers many more pos­si­bil­i­ties, each with poten­tially dif­fer­ent musi­cal outcomes.

Tags: , , , , , , , ,