Musical Flocks

Musical Flocks is a project in the field of music visualization. It produces animations by simulating the behavior of agents that react to the sound of music. Additionally, swarm-like behavior is attained by following the rules of separation, alignment and cohesion. This process produces reactive animations and static artifacts that constitute representations of the pieces, with different genres resulting in artifacts with distinct visual properties.
Each agent, or boid, senses specific frequency intervals, reacting to the volume level of those frequencies and to the average volume level of all frequencies in the hearing range. The application reads the music file and executes a real-time analysis of the sound spectrum. The analysis of the spectrum and of its frequencies is performed using the external library beads, with the implemented Fast Fourier Transform function. The processed spectrum consists of an array of 256 samples, each one having an associated volume value, being represented on screen by 256 boids. During playback, the flock moves inside the application’s window and reacts to the volume of the sound, leaving movement tracks. The variation of the properties of each boid represents the volume frequencies of the music being played. In silence, the behavioral changes of the flock cease to exist and the group stops moving.

Figure 1

Musical Flocks from Ruslan Kamolov on Vimeo

The visual characteristics of each boid depend on the volume level of the corresponding frequency interval, with size, saturation, brightness and opacity being proportional to volume. As such, low volumes result in small black circles with low opacity, while high volume results in large and opaque red circles (see Fig. 1). Likewise, the behavior of each agent is also influenced by volume, perturbing its movement’s direction, with high volumes resulting in large perturbations. The average volume of all frequencies determines the activation of these behavioral modifiers, which only become active above a given threshold.
Figure 2

Detail of Musical Flocks


The global behavior of the flock depends on the following parameters: separation force – the value of the force prevents a boid from colliding with neighbors; alignment force – the force that makes a boid steer towards the same direction as its neighbors; cohesion force – the force that makes a boid steer to the center of its neighbors, to stay within the group; force strength ratio – maximum limit for each of three forces applied to all agents in the flock. Different parameterizations of the flock’s and boids’ properties modify the overall dynamics of the group and of its members, affecting the visual results.

Figure 3

Screenshot of Musical Flocks

The visual results depend on various aspects, such as the genre and the tempo of the music, the intensity of the sound, and the instruments played. These aspects modify the temporal evolution of the music and its frequency spectrum at every frame, resulting in differentiated visual artifacts. Slow music makes the flock react gently and move slowly (see Fig. 2), while a fast music tempo results in fast movement and abrupt changes of direction. Sounds with high volume and rich frequency spectrum affect the majority of the boids, while low volume level and less quantity of active frequencies produces subtle visual variations and a slower graphic evolution. The video below shows the animations of two complete tracks of distinct music genres.

Presence in exhibitions


  • Musical flocks, BRIDGES 2013 — Mathematical Art Galleries, Enschede, Netherlands, 2013


In Proceedings

  • R. Kamolov, P. Machado, and P. Cruz, “Musical flocks,” in Special Interest Group on Computer Graphics and Interactive Techniques Conference, SIGGRAPH ’13, Anaheim, CA, USA, July 21-25, 2013, Poster Proceedings, 2013, p. 93.


Ruslan Kamolov

Pedro Miguel Cruz