The Life of an English Major

  • About the Blog
  • Legal Stuff
  •  

    February 2009
    M T W T F S S
    « Jan   Mar »
     1
    2345678
    9101112131415
    16171819202122
    232425262728  
  • a

  • Pages

    • About the Blog
    • Legal Stuff
  • Meta

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.com

Cell Music / Brain Music

February 15, 2009 @ 11:27 am — asymptote

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.

Posted in NetLogo, Programming, Simulations. 1 Comment »
Blog at WordPress.com. • Theme: Garland by Steven Wittens and Stefan Nagtegaal.
  • Bookmarks

    • My Flickr Photostream
    • My Twitter Page
    • WordPress.com
    • WordPress.org
  • Archives

    • December 2009
    • November 2009
    • October 2009
    • September 2009
    • August 2009
    • May 2009
    • April 2009
    • March 2009
    • February 2009
    • January 2009
    • December 2008
    • November 2008
    • October 2008
    • September 2008
    • August 2008
    • July 2008
    • June 2008
    • May 2008
    • April 2008
    • March 2008
    • February 2008
    • January 2008
    • December 2007
    • November 2007
    • October 2007
    • September 2007
    • August 2007
    • July 2007
    • June 2007
    • May 2007
    • April 2007
    • March 2007
    • February 2007
    • January 2007
    • November 2006
    • October 2006
  • Misc

    • Log in
    • WordPress.org
    • WordPress.com