“Secret [L]ife of Plants”: Compositional Approaches to L-Systems
by Timothy Gmeiner & Brian Tice
Abstract: This project aims to create a musical composition based on the relationship between human and computer-generated algorithmic decisions. L-Systems are utilized to arrange and generate rhythm and tonal elements of a song. The L-System algorithm will operate both on pre-existing rhythmic clips and chordal/melodic relationships between notes. In addition a Max4Live spectral domain filter is introduced that utilizes L-Systems to generate filter parameters. With a conscious effort to iteratively reflect on the output of L-system chord, melody and rhythm structures, we aim to create a new composition aided by L-system grammars, which are implemented to determine orders of chord progression, played by Timothy Gmeiner, and acoustic drum clip recordings with custom L-system based equalization effects, played by Brian Tice. The composers refine these results by replaying them with affordance of human artistic choice in arrangement and texture. Parameters of these results are used as the alphabet for a new L-System with rules used to engage melodic form through additional instrumentation.
Introduction: L-systems were introduced in 1968 by Aristid Lindenmayer as a means to study plant development. They are generative grammars that start from an axiom string across a predetermined alphabet. Rules are then applied in parallel to each element of the string for a determined amount of iterations. Though most widely implemented visually, L-systems can be interpreted compositionally as well. The most common integration of L-systems into composition involves fractals, however approaches have been wide-ranging. Composer Charles Dodge mapped fractal geometries to microtonal pitches, others have mapped L-systems from scientific data. Composer Przemyslaw Prusinkiewicz proposed mapping L-systems graphically and extending musical properties like pitch height and amplitude along the geometric results.
Keeping in spirit with the botanist origins of Lindenmayer Systems, we chose to build our core melodic and chordal dictionary and rules based on Stevie Wonder’s “A Journey Through the Secret Life of Plants”. The goal was to find a song on the album with a rich collection of chords and see how new musical directions might emerge through the guidance of various L-systems. This choice in source material also aligns with our exploration of human-computer-interaction throughout the entirety of the creative process, and our goal of maintaining humanistic results from algorithmic approaches.
Chords: Python is used to run a Constant Q Transform on the first 8 measures of Stevie Wonder’s “Send One Your Love”. A filter scale of 6 and threshold of 30 was found to give the best results, though these results were compared against existing sheet music for error correction. Additional ear training solved inconsistencies from both analyses.
Ableton Live was then used to transcribe and expand these chords into a 12-measure MIDI clip. Each measure contains a unique chord block except for two that naturally match based on two repeating chords within the song’s first 8 measures. This 12-measure clip was manually chopped into single-measure chord blocks, expanded to 4 measures, and then randomized to get a sense of chordal relationships before developing and applying a formal l-system. These individual chord blocks were saved as a set of 12 MIDI files (i.e. Stevie_A.mid).
figure 1-1: table of chord blocks
The chord block notes were arranged in a table in sequential order with a variable A-L applied to each block (see figure)
Python was then used to assign these .mid files to variables A-L. An L-System was created with axiom ‘A’ and rules designed to extend the relationship between near-neighboring chord blocks while slowly allowing each block to connect to other blocks within the 12-measure series. This L-System was iterated through 12 times to achieve these results.
A function was created to eliminate all neighboring block repeats. For example, an ‘E’ at index 4 following an ‘E’ at index 3 would be eliminated, allowing a constant evolution of chord progressions.
Another function was built to give a grounding form to the overall structure:
The natural 4th chord block D and eighth chord block H were substituted over the existing element at index 4 and 8 respectively as generated by the l-system.
The 37-48th indices were replaced with a sequential run of the chords to give a sense of resolution to one round of the l-system
These replacements are then repeated every 48 measures.
The L-system sequence, presented as a string containing numerous characters, was transformed into an array of individual characters. A dictionary was applied such that each character pointed to its respective variable containing a .mid object. For example, character ‘A’ in an array points to var A which contains the file ‘Stevie_A.mid’. The updated list of MIDI objects derived from the L-System appends to a single final .mid file which can then be exported to Ableton for observation and mapping to drum clips (see code below).
This collective .mid file was exported back into Ableton for verification of success. Each of the initial 12 chord blocks was then played by hand to offer a human touch and substituted into the L-System results.
Melody: A Max/MSP patch using objects from the Bach & Cage external packages builds upon existing chordal, spectral and rhythmic l-system structures by applying L-systems to rhythmic and melodic traits of an accompanying solo melody. Both rhythm and melody are given a separate set of alphabets, axioms and rules, then wrapped together to be launched and iterated over as many times as the user would like (with respect to processing power).
The L-system for notation is designed as such: each note upon first iteration is substituted with either notes from the existing chord block or near adjacent notes in the scale. The dictionary is written in standard notation (C5, Eb4, etc.) and covers just over 2 octaves of the scale. Each note maps to its analogous MIDI key numbers. There are two sets of rules and axioms, as one series of chord blocks (I-L) modulates to a different key which changes the dictionary. The rules for melody were guided by existing notes within the chord as well as fragments of melody lines read from the source material, Stevie Wonder’s “Send One Your Love”.
The l-system for rhythm is designed similarly. The dictionary consists of: {1 : Whole Note, 2 - Half Note, 4 : Quarter Note, 8 : Eighth Note, 16 : Sixteenth Note, 32 : Thirty-Second Note}. Each note length (1, 2, 4, etc.) substitutes notes at half, and then a quarter of the initial notes length. This was intentionally mapped to present results that simulate jazz-piano-style improvisational finger roles.
Both sets of rules are then wrapped and routed to a piano roll that visually represents both pitch and meter, changing as each manual iteration takes place. For this experiment, elements of MIDI files for 5 and 6 iterations were used for the final piece, however, users are invited to experiment with iterations or their own sets of rules.
The MIDI clips are then imported back into Ableton and altered lightly by hand rhythmically for a more natural 'human player' feel. The areas within these MIDI clips that fit rhythmically and harmonically with chord blocks were chosen and aligned with a partnering chord block. For example, chord block A (see figure 1) populates the piece 5 times. Its accompanying 4-measure melody line populates at the same locations.
L-System Spectral Filtering in Percussion HERE
Conclusion: This project leaves room for further exploration into L-system use. Melody lines can be immensely refined through greater use of probabilities via stochastic and hierarchical grammars as well as parametric extensions. Chords can be unpacked and potentially enriched through more nuanced approaches to polyphony. Designed as a ‘musical sketch’, this project also leaves room for collaboration with musicians, inviting human improvisation into the relationship. In addition, L-systems can be mapped to more audio effects than just spectral filters in the future.
Contact: Timothy Gmeiner: tgmeiner@ucsd.edu | Brian Tice btice@ucsd.edu