16 April 2008

The Golden String

Here is a short piece of music generated using the Golden String - a binary sequence that starts out as 101011011010... and continues on forever (as these things tend to).

One way to build up the sequence looks like this:

  1. 1
  2. 10
  3. 101
  4. 10110
  5. 10110101
  6. 1011010110110101
Steps 1 and 2 are given; after that the sequence at each step grows by joining the sequences at the two preceding steps. As the sequence grows, the ratio of the number of 1s to the number of 0s approaches the Golden Section (~ 1.618), a number that pops up in nature, geometry and artistic composition. The sequence is also fractal, meaning that it appears similar when examined at a range of scales. You can even lop bits off the front and still get back to the original sequence !

You can find a much better explanation of the Golden String, and its many properties on this page, part of Ron Knott's stupendously encyclopedic Fibonacci web site.

To generate the piece I mapped the binary sequence to musical notes in two ways. Firstly, a simple mapping of 1s and 0s to low pitches to provide a background rhythm. The second mapping is a bit more interesting. The sequence was progressively read as seven-digit chunks (ie. chunk 1: positions 1-7 / chunk 2: positions 2-8 etc.). It turns out that only eight unique chunks of length seven can be found in the Golden String. I sorted these, treating them as binary numbers, and mapped them to notes in the A major scale (not for any deep mathematical or compositional reasons, I just like A major).

0101101 => A
0110101 => B
0110110 => C#
1010110 => D
1011010 => E
1011011 => F#
1101011 => G#
1101101 => A (next octave)

Using JFugue, I set two instruments to play these mapped notes in the piece, one starting slightly behind the other.

Daniel Cummerow, a web-pioneer of algorithmic music, has also based a piece on the Golden String, using quite a different approach for the mapping. You can listen to it here.