DaveKoelle.com ->  Explorations ->  Algorithmic Music

Algorithmic Music
I am fascinated by devising ways in which computational processes can generate new and interesting music. This article contains some of my algorthmic compositions, and describes some ways that I create this music.


I've listed my compositions first, so you can listen to the music and get excited about it before delving into the processes that create it. For more information on the creation of these pieces, read the following sections.

I use JFugue to program my compositions and generate MIDI. JFugue is an open-source Java API for music programming that I developed to bring music programming to the masses, and to enable algorithmic composition.

There's not much here yet, but this is a work in progress (no construction icons, that's so Web 1.0), so check back occasionally

  • Kebu (Listen: kebu.mid) Kebu is generated from a Lindenmayer system with the following definition:
    • Axiom: T120 | V0 I[Flute] Rq C5q | V1 I[Tubular_Bells] Rq Rq Rq G6i+D6i | V2 I[Piano] Cmajw E6q | V3 I[warm] E6q G6i+D6i | V4 I[Voice] C5q E6q
    • Transform 1: Cmajw  -> Cmajw Fmajw
    • Transform 2: Fmajw  -> Rw Bbmajw
    • Transform 3: Bbmajw  -> Rw Fmajw
    • Transform 4: C5q  -> C5q G5q E6q C6q
    • Transform 5: E6q  -> G6q D6q F6i C6i D6q
    • Transform 6: G6i+D6i  -> Rq Rq G6i+D6i G6i+D6i Rq
    • Number of iterations: 3

  • Misiba (Listen: misiba.mid) Misiba is generated from a Lindenmayer system with the following definition:
    • Axiom: T180 | V1 I[SYNTHSTRINGS_1] C5q G5q C6i B5i G5q | V2 I[FIFTHS] D4i B3i G4h B3i C4i | V3 I[VOICE_OOHS] D4i G4h B4i C5i B4i | V4 I[NEW_AGE] C6i B5i G5q C5q G5q
    • Transform 1: G5q  -> B5i D4i C5i D4i
    • Transform 2: B3i  -> B3s B3s
    • Transform 3: D4i  -> D4i B3i C5i
    • Transform 4: B5i  -> B5i G5i D4i C5q
    • Transform 5: G4h  -> C4i G4i C4i G4i
    • Transform 6: C5q  -> G5s B5s C6s C6s

Grammatical Rewrite Systems (Lindenmayer Systems)

A Lindenmayer System is a grammar rewrite system that has been used to model plant structures and fractals. In grammar rewrite systems, the letters (or, more formally, "alphabet") of an initial sequence (an "axiom") are each replaced with definitions for those letters ("transforms") to generate a new sequence. This process is repeated on the new sequence for a number of times ("iterations").

For example: Suppose you're given an axiom of "AB", and the transforms "A  -> BA" and "B  -> A". To create a new sequence, go through each letter of AB, and replace each letter with the definition provided by the transforms. In this case, AB would be converted to BAA (A changes to BA, and B changes to A) in the first iteration. To iterate a second time, take BAA and replace each letter with its definition; you'll get ABABA. The third time, you'll get BAABAABA. If you introduced a new letter into the sequence but don't define a transformation to it, that letter is kept in the next iteration.

After converting the sequence using the transformations, the sequence is then rendered in some form. Traditionally, it the sequence has been used to draw graphics - mostly plants and fractals, but also seashells and other patterns. In this case, the letters may have a graphical representation. For example, given a sequence like "F++F-F++F" and a LOGO-like turtle that will draw the graphics, "F" might mean "draw a line forward", "+" means change the heading in a clockwise direction, and "-" means change the heading in a counterclockwise direction.

The use of Lindenmayer Systems in drawing trees and plants has produced some phenomenal work (see Przemyslaw Prusinkiewicz's "The Algorthmic Beauty of Plants", available online for free). Wikipedia's entry on L-Systems contains examples of Penrose tilings, Koch curves, and other patterns.

In my case, I use JFugue tokens as the "letters" or "alphabet" of a sequence. My axioms contain a MusicString, which is playable by itself; after each iteration, it is transformed into a more interesting set of music with repeating patterns.

This process still requires some creativity on my part: I first create interesting-sounding riffs on my keyboard. Once I make some good riffs, I program them into the axioms and transforms. Then I let the algorithm do its thing.

Agent-Based Constraint Satisfaction (Compicles)

One of my latest explorations involves Compicles, a name I have given to little pieces of code ("computational particles", you might call them agents) that each have specialized knowledge for transforming music in particular ways.

I'm using Compicles to explore a number of ideas in artificial creativity, and I'll be using them in music to try to create original hip hop beats.

DNA Music

DNA music is created by taking a strand of DNA and converting the sequence into music. I take each set of three codons, which represent amino acids, and assign a different musical instruction to each of the amino acids.