The decimal digits of the mathematical constant pi, 3.14159265. . ., ring out an intricate melody that sounds vaguely medieval. Those of the constant *e*, 2.718281828. . ., progress at a relentless, suspenseful pace. Euler’s prime-number-powered phi function bounces about with a semitropical rhythm. Lorenz’s butterfly meanders through a ragged soundscape. Pascal’s triangle echoes with an eerie beat.

Created by Swedish composer Daniel Cummerow, these mathematical sound bytes belong to a category known as algorithmic music. Each musical fragment is determined by a mathematical recipe–a formula that links digits with musical notes and their duration, as governed by the musical preferences of the composer.

## Science News headlines, in your inbox

Headlines and summaries of the latest Science News articles, delivered to your email inbox every Thursday.

Thank you for signing up!

There was a problem signing you up.

If you have browser software that can play MIDI (Musical Instrument Digital Interface) files, you can sample Cummerow’s compositions at his Web page. The MIDI specification is often used in computer programs to represent musical notes. It assigns a number to each note on a keyboard: Middle C is 60, C-sharp is 62, and so on, for a total of 128 tones.

Composers of algorithmic music can employ a variety of strategies to achieve interesting results. For example, you could simply convert prime numbers, evenly divisible only by themselves and 1, directly into their corresponding MIDI notes, at least up to 127, to get a curiously rising scale.

There are infinitely many primes and they get larger without limit, however, so you could continue by dividing each prime by a certain number, then use just the remainder–a neat application of modular arithmetic. Adding a constant keeps the corresponding notes within an “accessible” part of the MIDI scale. See Chris K. Caldwell’s “Prime Number Listening Guide” for examples of this sort of transformation.

## Subscribe to Science News

Get great science journalism, from the most trusted source, delivered to your doorstep.

Instead of mapping digits directly to MIDI numbers, you can also assign them to notes of a specific scale. In one of his pi compositions, Cummerow constructed the piece by assigning each digit from 1 to 8 to a note of the A harmonic minor scale. The digit 0 signaled a pause, and 9 meant either a pause or a repeat of the previous tone. Identical consecutive tones were tied together into a longer note.

In another pi venture, Cummerow used a special musical alphabet formulated by French composer Olivier Messiaen (1908–1992), which extended the German names of the notes, A, B, C, D, E, F, G, H, by giving each letter of the alphabet from A to Z its own pitch, octave, and note value. Cummerow went through the first 255 digits of pi in pairs. If the number were 26 or less, he assigned to that pair of digits the corresponding Messiaen note. If the value exceeded 26, he followed a different recipe.

For a four-part piece featuring the digits of *e*, Cummerow worked with three-tone chords of the E whole-tone scale. Within an octave, there are 10 ways to construct such a chord. Taken in pairs, the first digit (from 1 to 8) of each pair determined the pitch, and the second digit determined the chord. Also mapped to the E whole-tone scale, his “Prime Numbers Whole Tone Quartet” was determined by prime numbers expressed in base 5.

Other recipes led to compositions featuring the Fibonacci sequence, trigonometric functions, Pascal’s triangle, and fascinating structures such as the Sierpinski triangle and Lorenz’s butterfly, now intimately associated with chaotic dynamics.

Cummerow is not the only composer to have delved into mathematical music. For example, a number of musicians have played with the fractal notion of self-similarity, in which each smaller piece of a structure is a miniature version of the larger structure. Brazilian composer José Oscar Marques has some interesting examples.

It all adds up to some intriguing sounds of music.