Fractal Fugues
film
Licence
Credits
- Jeffrey Ventrella
Fractal Fugues are self-similar structures made from a simple motif which generates copies of itself. These copies are transformed in the dimensions of time and pitch.
INTRODUCTION
Music is naturally self-similar. Melodies, rhythms, and sonic qualities recur in time, with theme and variation. Identical melodies that start at different times and pitches can weave among each other to create intricate counterpoint: fugues. Fractal Fugues are sonic structures that have mathematical self-similarity.
VISUAL DISPLAY
Colored circles represent musical notes. A connected sequence of notes is called a “motif”. The vertical axis represents pitch (circles near the top represent higher pitch and the circles near the bottom represent lower pitch). The horizontal axis represents time. Notes are always played from left to right. The size of the circle represents the duration of the note. The color of the circle represents the fractal level of recursion (red, orange, yellow, green, blue, and violet).
FRACTAL STRUCTURE
Each fugue is based on a “mother motif”, which consists of a connected sequence of red notes. The mother motif gives birth to copies of itself (its “children”) - shown in orange. Each child has its own unique transform (a unique offset from the mother’s time, pitch, and duration). These child motif’s then give birth to more copies (yellow) that are offset in time and pitch using the same transform - scaled proportionally to the fractal level (generation of offspring). There can be up to six levels (generations of birth - shown in all colors), resulting in generations of notes multiplying at a high exponential rate. Because the same transformation are applied to each generation of children, the result is a fractal (self-similar) structure.
HOW NOTES ARE PLAYED
A time transformation can be negative! (earlier in time). The animation and audio of notes being played is not necessarily correlated with the order of birth from mother to child: earlier generations don’t necessarily play earlier in the final composition. The animation shows the transformations applying at the same time that the final result is played. This is basically an animation effect that reveals how a child transformation can result in notes that are played “earlier in time”.
GENETIC ALGORITHM
The number of parameters used to specify any particular fractal fugue is large - given the range of pitches, variation in tempo, the range of note durations and rests, (silence between notes), and the various transformation parameters for children (which can be unique for each child). Given the large set of possible parameters, any random configuration of parameters usually sounds terrible. However, there are some delightful melodies and rhythms hidden within the sea of randomness. These can be searched and optimized using a genetic algorithm.
The genetic algorithm works as follows: (1) A population of fugues is created with random parameters. (2) the user listens to a randomly-chosen fugue and gives it a score (bad, okay, or good). (3) The user continues to listen to randomly chosen fugues and score them - as many times as desired. (4) The lowest-scoring fugues are automatically killed, and the highest-scoring fugues are given a chance to mate via genetic crossover - creating new fugues that inherit their qualities. The user’s scoring can encourage more rhythmic, more harmonious, or more chaotic effects. These qualities are NOT explicit in the fugues themselves - rather, they are encouraged by the user, by way of repeated breeding. This is not musical composition in any traditional sense of the word - it is more like audio gardening - breeding a population to have certain melodic or rhythmic traits that are considered more interesting than others.
TECHNICAL
The Fractal Fugue system was written in JavaScript, and it uses web audio oscillators. Visual effects are created with html5 canvas. The realtime version is available at http://ventrella.com/fractalfugues/ (Warning: the audio is not very good in the Safari browser on the MacBook. Chrome is recommended).
PROPOSED INTERACTIVE VERSION
While the current version of the code plays fugues that are pre-defined before they are played, it is proposed that the “fractalizaton” (the generation of child motif’s) could be created on the fly - in realtime. This is possible because the definition of the mother motif is kept separate from the definition of the child transforms. Thus, one could conceivably play an ongoing sequence of notes (input via MIDI format) comprising an ongoing mother motif. The system could progressively fractalize the most recently-played notes - given a particular child transform that can be specified by the user. These transforms could be adjusted in realtime as well. The inputs could even be triggered by a voice or clapping hands, given appropriate sound-processing algorithms that convert analog sound events into MIDI events that trigger sound files.