Mathematics,  music-o-mat,  software

Irrational Composition (Happy Pi Day!)

Over the past week I’ve been testing the limits of my memory buffers by stuffing them with as much Pi as possible. At first things were going fine. Thirty gave way to fifty and soon seventy-five. But as the count increased, I began to notice something odd. Writing the numbers down was proving more difficult than reciting them. Maybe it’s the rhythm inherent in vocalizing. The sound of it becomes its own melody, which you learn in parallel. This may seem like a non sequitur, but it got me wondering about what a number might actually sound like. Call it numerical synesthesia.

There are many ways to create a mapping between numbers and notes. One is to use a chromatic scale, referring to the twelve tones of the western scale that repeat over a span of octaves. This is not an “onto mapping”, though, since there are fewer digits, 0-9, than available pitches. This therefore limits the musical range to a major 6th (the 10th half-step up from the root). But this can solved by translating the number into base-12: 0123456789AB.

There are a number of other mappings too, especially if you’re familiar with the musical modes. One is diatonic per the Ionian mode where we treat 9 as the 9th and 0 as the 10th. Or in less technical terms, a major scale from the root to a tenth above it. For example, in the key of C the sequence 79502884 translates to B1 D2 G1 E2 D1 C2 C2 F1, where the 1 and 2 indicate the octave. 

That’s how I first decided to tackle this Pi sound. Here’s the score corresponding to the digits memorized:

Pi Song

And here’s a brief recording of the first two lines above.

Several hours later I recorded the first 134 digits.


Meanwhile, my dad pointed out that other numbers would be interesting. The Golden Mean, “e”, and so on. Being a software developer, I went a little nuts with this idea. Over the weekend I built a small web application (React using ToneJs) that lets you hear various numbers across musical modes, keys, and tempos. You can even enter your own sequences.

You can take it even further, though, and regard the sequence as encoding not just pitch but rhythm and dynamics too, a la Milton Babbitt. For example, 314 could mean the third pitch, played for a duration of “1” (where 0-9 are subdivisions of a measure) and with a volume of “4” on a similar scale. Or going even further, the initial sequence of digits could be a preamble containing specific rules that the rest of the sequence should follow. A self-contained rulebook, so to speak. Such preambles (“headers”) are the basis of digital encoding (jpgs, mp3s, etc.).

This led to a startling realization. Here, we’re taking a sequence of numbers and translating it to notes. You can likewise take a melody and translate it to numbers (which is precisely what MIDI does). Pi is irrational and thus infinitely long and non-repeating. But it’s also thought to be a so-called normal number, which means that it contains every digit at the same frequency and from that, it also contains every finite sequence of digits too. Like a digitized melody. Thus, Pi may very well contain every melody ever written!

It’s a mind blowing thought.

For example, The Beatles “Hey Jude” begins 53365223…

Using the Pi search engine, one can find this eight digit sequence at Pi’s 131,113,489th digit. In theory though the whole song is in there somewhere (and not only that, but it’s in there an infinite number of times too).

Looking around online, I found that others (many, many others) have had the same idea, of course (corollary: there are no original ideas). For example, a former Star Trek actor recently posted a meme on Facebook about how Pi contains all of human history in its digits. It’s an interesting thought experiment. Namely, that not only does a normal number potentially contain every melody, it theoretically contains every digitized book and digitized photo too. And does so an infinite number of times. But suggesting that it contains “all information” is ridiculous. Pi can’t contain itself (or any other irrational number), for example. Also, this property (normality) of Pi has not been proven. The other problem, even if it was true, you’d probably need more time than the age of the universe to locate any specific work.

Still, even if Pi fails to hold our encoded human songbook, the vast majority of real numbers are in fact normal. Thus, most numbers do contain arbitrary sequences, an infinite number of times. Like digitized melodies. Which gets back to the original point. 

Wacky stuff, but fascinating….


Final thought about these mappings from the irrational. Using this app, it becomes apparent that what you’re really hearing is just a random outline of the chosen mode. After a few minutes, there’s likely going to be no discernible difference between Euler’s number and pi or any other infinite, non-repeating sequence. It’s the sound of the mode itself. Sort of like smashing your hands down on all the notes in a scale. The conclusion: it’s not that interesting. Yet if you were to apply some rhythmic variation, some accompaniment, that could all change. Maybe the Babbitt tricks would help on this front (i.e., let some numbers specify musical duration). Ultimately though, to make it musical requires human intervention. 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.