All at Once Everything Plays: L-Systems and Fractal Music

How Does Motion Populate?

That is the question when we look at the rhythm around us. Listen to a piece of music: for example, the rhythm feels almost inevitable, and we can predict how the notes go. This is because much of music follows a fractal music shape. A Bachian iterated variation follows a logical pattern and leads to the question: where do the sequences arise from? Bach: his music delights the ear, and his tunes seem natural and original. Perfect, they chase each other, what else could they do?

But it is simple, motion is efficient. It can be argued that life, what we create, what we do, is designed to be the most efficient and active process possible. We compete to fit, and are predictable. We inhabit structure in all we do. L-System mathematics explains why this is so.

This can be expressed in fractal-like structures. If we keep to the music thoughts, though fractal-like covers much more than sound, this is why we like pink noise. It is predictable, but not too routine. Just like back, we know the themes, but each variation is a delight.

Pink sound, classical music, our output of creative actions tends to have a Hurst value closer to 1, meaning we show persistence, a tendency to keep doing what we were just doing, not random. The L-system demonstrates this theorem. It is predictable, even when chance and chaos are factored in.

The Moving Turtle

The equation does not matter; regardless of the structure it models, it just is, a plodding turtle (that is what it is called) moving along as the background and foreground furiously unfold.

L-systems model language, architecture, art, and music. The turtle simply stands for that which reads the rules. For music, we have the seed, the single note, the alphabet, the notes and their directions, and the grammar, how notes move. This all unfolds as the system directs, moving in a fractal-like way.

The tool on this page demonstrates this. The seed is iterated according to four different rule sets. The music is lovely, even if we add chaos, as we do in Drift. The most amazing thing is that the complex is generated by just a few simple steps, but is powerful enough to produce what sounds like structured music. For a more complex system, see our MIDI generator tool.

L-system music generator — plays melodies derived from fractal rewriting rules using Web Audio, with an interactive piano roll

Iterations4
Tempo90 bpm
Interval2 steps
Scale
Waveform
Stochastic0%

F = play note · + = step up · − = step down · [ = push phrase · ] = return to phrase pitch · stochastic adds random rule variation each expansion

Lovely Ornate Music Made Simply

The tool on this page takes an L-system grammar and plays it as music. The same string the turtle would draw as a tree is read here as a sequence of notes; F plays a pitch, + steps up through the scale, – steps down, and the brackets open and close melodic phrases that return to their starting note, the musical equivalent of a branch returning to the trunk.

Four presets demonstrate four different grammars. Woodland uses the classic symmetric branching rule on a pentatonic scale, balanced, natural, unhurried. Bach has classical variations. Drift runs a more stochastic. Pulse is quick and a hurried step.

The iterations slider is the growth control. At iteration one you hear the rule applied once to the axiom. At iteration four the rule has fired on its own output three times over, and the original seed is deep inside a fractal structure you can hear but not easily trace back.

Turn the stochastic slider up to add chance, each F rolls a die before deciding which rule to follow, producing variations that share a grammar but not an identical form. Hit Regenerate to grow a different individual from the same rules. Same species, different tree.