Ever since I discovered it a few years ago, I’ve been fascinated by the idea of algorithmically-generated music, but I’ve lacked the programming skill to experiment with it myself. Well, the other day, I was sitting around and John Conway’s “Game of Life” cellular automaton came into my head. Somehow or other (I’m never quite sure how my ideas get started) that connected to my interest in generative music, and using NetLogo’s awesome sound-generation extension, I wrote a NetLogo program to run the Game of Life and turn the pattern of cells into musical notes.
That worked fairly well, but the Game of Life isn’t great for this application because the patterns tend to become less and less dense over time, and because of the way the model “plays” the cells (which I’ll explain in a moment), that means the music gets less and less interesting over time, until it’s basically just an endless loop with little variation.
Fortunately, there are other cellular automata out there, and the one I settled on for my next model was Brian’s Brain. The Brian’s Brain rules produce more active and interesting patterns, and the overall density tends to remain higher for longer. Also, the patterns that form have a structure that my intuition told me would be better-suited for conversion into music. The results, while not earth-shattering, were a lot more impressive than I’d been expecting:
Here’s how it works: at the beginning of each simulation step, the program selects the first vertical column of cells (that is, the one on the far left). It then asks those cells that are in the “blue” or “yellow” state (that is, state 2 or state 1) to play a note, with the pitch of the note based on the cell’s vertical height. Yellow cells generate a square-wave tone, and blue cells generate a sawtooth-wave tone. Then, the program waits for a fraction of a second before moving one column to the right and playing that colum in the same way. It continues like this until it’s played every column and reached the right edge of the world. Then, the cells evolve one step (according to the Brian’s Brain ruleset), and the process begins again. Although the “music” starts out a little rough (since the cells’ values are set randomly at setup), eventually, there’s enough order and structure in the patterns that the noises sound almost musical.
As usual, I’ll go about uploading this to the NetLogo site, and I’ll keep you posted on any interesting developments.
February 17, 2009 @ 5:30 pm at 5:30 pm
Looks pretty interesting