Experiments with Particle Swarm Optimization

Particle Swarm Optimization (PSO) is an algorithm originally developed by scientists James Kennedy and Russell Eberhart (1995; 2001) for optimizing nonlinear functions. It is related to artificial life, flocking behavior, and evolutionary computation. PSO is rooted in the idea that the social sharing of information among individuals can be beneficial to an entire group. These pieces reveal the behavior of swarm agents and leverage emergence as a musical composition. Each uses the inherent self-organizing characteristics of the swarm as a mirror to the emergent dynamics of an interactive system. Swarm behavior not only reflects the nature of mediated interaction; it can be used sonically to demarcate specific events within an interaction, transforming each into a fabric of sonic events within a continuous musical becoming.

An essential aspect of Kennedy and Eberhart's algorithm is the sharing of information between agents. When the swarm is initialized a space is defined. Within it, swarm agents are randomly distributed and a point is established as the target that each agent is meant to find. When the search begins, each agent computes a new trajectory based on A) a personal best (pbest): the point it, individually, has found nearest the target and B) a group best (gbest): the nearest pbest in the entire swarm, which is frequently updates and simultaneously shared among all agents. Each agent then randomly selects a point between A and B and moves to it (see below). This process repeats very quickly (24-30 times/second) to create an elegant, elliptical movement that appears like the swarming of insects. Distance from an agent to the target is called "fitness." Over time, through individual work and social sharing of "bests," agents seek greater fitness (a value approaching 0), and the swarm coalesces at the target. With the original, intended use of PSO, the search would be considered complete and the problem solved once the target is found. With my use of the algorithm, this first success is only the beginning. I use PSO to construct continuous music and therefore, the swarm must keep going. When any agent's fitness is below a predefined threshold (usually between 1-5), the target is moved to a new, randomly selected position within the search space and each agent's search begins anew.

Emergent dynamics were used as the point-of-departure for a musical work. The first three particle swarm-driven works—PSO[1], PSO[2], and AUTOMATICBODY—make no provision for interaction. Rather, they were loosely structured with an underlying collection of sonic material that could be arranged and re-arranged to create a framework of musical possibilities. The various musical components coalesce to realize an ever-changing composition that has the flexibility to adapt itself to the twists and turns of an interactive exchange between networked individuals, user and system, performer and performance space, or audience and composer. The algorithm proved to be incredibly robust and has served as the generating force for many of the projects created 2004-2010.

Launch PSO[1] in a new window
Launch PSO[2] in a new window
Launch AUTOMATICBODY in a new window

Experiment with Particle Swarm and Realtime Synthesis

After completing the first three particle swarm works I was curious as to whether the use of pre-recorded sound files masked the potential sonic dynamics of the swarm. max.s.o (later re-named A(rt)Life 1.0) sought to continue exploring the possibilities of particle swarm optimization.

Swarming arises through the collective, social behavior of swarm agents. Personal bests, group bests, and measures of fitness are evaluated throughout. In addition to these parameters, the velocity of an agent is representative of the minute adjustments made as the agent swarms, seeking greater fitness. This information, and the organization or structure it contains, provided the framework of a non-interactive, generative musical work. By tracking the horizontal and vertical velocities of each agent at moments of optimization (new pbests), the swarm's visual order can be documented numerically. Max/MSP, a graphic programming environment, was used to transform this numeric output into sound. Each agent was designed to send its current velocity and a list of other swarm-derived values to a simple sine wave generator. The sound module then plays a tone drawing on these incoming values. With 20 agents and nine sound modules, the project is a kind of experiment in real-time additive synthesis. However, this ratio proved to produce the most clear and varied texture, as emerging trends in an agent's velocity would produce everything from pointillistic, rhythmic pings to sweeping, dramatic washes of sound.

Listen to max.s.o/A(rt)Life 1.0 audio recording: