• Search
  • Lost Password?

Algorithmic Music: An Experience Composing with WolframTones

Logic Pro screen capture from WolframTones project

Andrew Whitacre on how to use algorithmic music generation in WolframTones as the inspiration for a full, human-sounding composition.

Around here we’re big fans of computational art, with our best-known work being that of professor Nick Montfort. Nick makes algorithmically generated poetry and visual art, and when I did a podcast with him last year, I needed music for the intro and wondered if there was a way to generate music algorithmically too. That’s when I stumbled upon WolframTones (more on that in a minute). Since then, I’d always wanted to return to that method of composition to see if there was a way to use WolframTones to create something listenable without relying on familiar melodies nor needing formal music training. So I went ahead and did just that, and this post shares the result. I thought I’d say a few words about the process, since it might not be obvious 1) what it means to say a tune was based on an algorithmically generated melody and 2) how you might do it yourself.

If you go to tones.wolfram.com, you’ll see something pretty cool, though intimidating. The site applies a universal principle from scientist Stephen Wolfram: that you can start with something simple, like a few adjacent black and white squares, and generate something complicated from them just by defining some rules to how those squares should replicate. You can apply that principle to an array of fields, from language processing and cryptography to, here, music.

In the case of WolframTones, there are two sets of rules you define. One is musical constraints — like which MIDI instruments to use, what scale, what tempo. And the other is the mathematical details of the algorithm…the rules that decide which instrument plays which note and for how long.

Now, when you algorithmically generate black and white squares, you’ll always see what looks like a cascading pyramid of squares; Wolfram’s discovery was that no matter what constraints you set, that resulting pyramid always features some level of order. WolframTones lets you cherrypick from that pyramid and grab the swath of notes that seem to have some order.

Pyramid of squares with swath selected
WolframTones uses algorithms to generate squares that specify musical notes. The user can choose what swath of squares to include in the generated music.

Basically you get to ID the best stuff and turn it 90 degrees to display it left to right, looking a lot like an abstract, colorful musical staff. So in WolframTones, a colored square is a sound to be played, and, just like on a musical staff, its vertical position is the note. Meanwhile, a white (or other default color) square is silence. Put those together and you have something approaching a melody. In WolframTones, it looks something like this:

Example of WolframTones visualization of generated notes
You can listen to (and mess around with) this output at tones.wolfram.com.

That said, it’s rarely a pleasant melody. That’s where we humans come in. Recently I exported this WolframTones result as a MIDI file and imported it into Logic Pro, Apple’s digital audio workstation and MIDI sequencer software. I slowed the tune down…the tempo you hear in my “humanized” version below is about ten times slower than the original.

I then assigned different notes to different digital instruments in Logic. First I selected the higher notes and assigned them to a custom instrument I designed. Then I selected the mid-range notes and assigned half of them to an 80’s style electric guitar and the other half to a bass. Finally I took the lowest notes and assigned them to an electronic instrument called Bellerophon Sector, a kind of slow, ambient, but gritty digitized sound.

Once the notes were broken out into different instruments, you could start to make out pleasant melodies. I started deleting individual WolframTones-generated notes that obscured the melodies, helping the melodies stand out and coincidentally providing the outlines of a workable rhythm. After that, I moved on to real composition: finding and composing counterpoints (when one instrument seems to reply to or complement what another has played), adding and layering notes to build chords to help orient the listener (orienting the listener in algorithmically-generated music is terribly hard), writing a drum track, and giving the tune a longitudinal shape…that is, making the tune feel more like a song unrolling over the course of two minutes, with an intro (in this case there’s a lot of noodling before the first clear melody in the sixth measure), a crescendo (in measure 10), and a melodic back-and-forth between instruments from measure 13 to the end.

The final product is what you hear in the embedded video at the top of the post. (The visual part of the video is a screen recording of the tune playing in Logic Pro.)

This method of composition isn’t too different than what you’d see from someone like Brian Eno, in that it is indeed a method. Its point is to make discovery or serendipity easier; you may still ultimately end up with a pop-sounding song, but you won’t be following anyone else’s path to get there. You can analogize this method to Eno’s and Peter Schmidt’s  “Oblique Strategies” cards, made not to push musicians to take a specific course of compositional action but to break musicians out of creative ruts. The most intimidating part of the creative process after all — and where so many people call it quits — is staring at a blank page. WolframTones avoids that by generating compositions that you can then spend time pulling the best ideas from.

Andrew Whitacre
Written by
Andrew Whitacre

Andrew directs the communications efforts for CMS/W and Responsible AI for Social Empowerment and Education. A native of Washington, D.C., he holds a degree in communication from Wake Forest University, with a minor in humanities, as well as an M.F.A. in creative writing from Emerson College.

This work includes drawing up and executing strategic communications plans, with projects including website design, social media management and training, press outreach, product launches, fundraising campaign support, and event promotions.

Andrew Whitacre Written by Andrew Whitacre