This page originated from a contest of NRC handelsblad (a Dutch paper) for the most interesting music on he decimals of π. I considered it a good idea to use a Musical Generator. However, it more or less ended up as a tutorial on using a Musical Generator.

You can download the music, and try it out for your enjoyment. I assume familiarity with π and MIDI. You can click on the respective links to get more information on these topics.

yamlTable of contents

yaml Converting decimals of π into music

Converting the decimals of π into music will be boring to begin with. There are ten digits, which can be assigned to ten notes. When looking at a graph of the decimals (see below) they make a random appearance and it sounds like that. The material should be edited in various ways in order to make it sound acceptably. The problem of sounding the decimals of π can be generalized to another problem: how to convert numbers into music, what aspects should be taken into account to make it into something worthwhile?

How to...

Back to table of contents

yaml Converting numbers into music

When being asked to convert numbers into music, people tend to look at the melody first. The notes, or pitch of the music seems to be the most important aspect of music. But there are other aspects, dynamics, the duration of the notes and the place in the musical piece where they are played. But also the instrument plays a role. In short, there are a desperate amount of possibilities to convert the music. Where to begin?

It seems logical however, to start with the notes. The other aspects will only be relevant when notes are present. Let us imagine a (MIDI) keyboard with 128 keys and assign numbers to all keys. We can assign the decimals of π (or any other collection of numbers) to this keyboard and music we have. If we play this however, we hear some vague rumbling. Why is this? The first ten keys, which is the lowest register of a keyboard, contain the numbers 0..9. We can change this by adding a constant to the numbers of π, for example 60. This yields some slightly better results. We can also leave one key unused, so the keys used will be 60 (C), 62 (D), 64 (E), 66 (Fis),... We can assign the same numbers to different keys and different distances, we call this rescaling.

Uptill now we used all keys of the keyboard. But most music uses only a limited amount of notes, which is dependent on the musical scale. If we use the Major scale, the decimals of π could be assigned to C, D, E, F, G, A, ... This sounds different again. The Minor scale sounds different than the Major scale. When we apply the Pentatonic scale the decimals of π sound even like Chinese music. Though the decimals of π look boring on first look, we have seen that we can vary them widely, even though we have only looked at the pitch of the numbers. Exactly the same material can sound in a total different way. What more we can do with the basic material will be shown in the next chapter.

Back to table of contents

yaml Editing the basic material

Suppose we cumulatively add the decimals of π. This yields a not so straight line up, ever increasing pitches when translated into the keys of our keyboard. We can also subtract 4.5 from each digit and compute the cumulative sum of the decimals. You can see the effect of both computations below. The last edit operation shows a line that is not purely random, but shows some increasing parts and some descending parts. This sounds more like real music.

Back to table of contents

yaml Other aspects

We can also assign the (edited) decimals of π to the dynamics, the duration of the notes and to the time on which the notes have to be played. In the MIDI specification the volume is divided into 128 steps, where 0 means silence and 127 the loudest music possible. We can of course assign the same (edited) π to the notes as to the volume, which means that the higher the note, the louder the music and vice versa. We can also assign π itself to the volume resulting in a random like character of the dynamics of the music.

Also the duration of the notes can be varied. How to vary this can be best learned by trial and error. In the MIDI convention the 32nd is the shortest note and it has a value of 1. Other lengths of notes are expressed in multiples of 32nd's, the longest possible duration being a little more than four days. In this example π itself is assigned to the duration, with a 16th note as the minimum duration (translated into 2 (32nd's)) and a whole note as the maximum duration (32 32nd's). Of course we can change the instrumentation.

The MIDI specification has defined 128 instruments, varying from piano to violin and from synthesizers to helicopter sound. I have added an example with steeldrum, where π is assigned to the volume as to the duration of the notes. I have used some examples to illustrate how important it is to think about all kind of aspects of music before starting to convert numbers into music. I have also tried to show how some simple basic material can be varied infinitely by changing some simple assumptions. By playing with the basic material more variation can be created.

Back to table of contents

yaml More voices

Uptill now we have treated one music voice. We can create polyphonic music however. But each voice should have another melody at least, so we must create several different edited p's. We can create a new π by mirroring it around zero. Below you can find a graph of the resulting operation. I have created an example with two voices. The first voice uses the accumulated π with a duration of a quarter note for each note and a vibraphone sound. The second voice uses the mirrorred cumulative sum of π with a duration of eighth notes and a piano sound. Listen to it in C-major.

Back to table of contents

yaml Some pieces of music

We have now seen some ingredients for creating music and we can use these ingredients to create (hopefully) more interesting pieces of music.

yamlExample 1. A Fugue

In a fugure several voices are introduced one after each other, all starting with the same theme. If the first voice has finished the theme, the second starts, but now in the dominant (a fifth hight or a fourth lower, octaves to be added or subtracted as you wish) while the first voice continues with the so-called counter-theme. If the second voice is finished, the third starts in the tonica (like the first one) and so on. There are some other rules to be applied but these I have ignored. And of course rules are te be changed. Bartok wrote a fugue where each voice started in the dominant of the former voice.

In this example I use besides the decimals of π, the decimals of e, the natural logarithm. I have edited these in the same way as the decimals of π, subtract 4.5 and cumulatively add the decimals. I have also computed a mirrored version. In the figure below you can see the difference with π. We see some small numbers, followed by a serie of large number preceded by an abrupt change. If the Mirror (Sum (e - 4.5)) is assigned to the pitch we will first hear some low notes, a sudden increase in pitch followed by many high pitched notes. We can also assign these numbers to the duration of the notes to get a slow beginning that sudden accelerates.In this fugue example I have done the last thing. In another example I have used a church organ as the instrument. It depends on your soundcard how the organ sounds. I have chosen for a Dorian musical scale with the tonica in D. The theme has a length of four (4/4) measures.

Back to table of contents

yamlExample 2. Minimal Music

In this second example I wanted to create a minimal music piece. There are several different interpretations of minimal music (listen for example to Reich and Glass), but in this example I have applied the theorie of phase movements (for example Reich, music for 18 musicians). This means that different repeating themse play together, but each theme has different length and/or different rythms. A good example of phase movements are church bells.

In this example some different phases are introduced and assigned to the note duration. You will hear the voices behave independently and after some time they'll come back again. For the music the cumulative sum of π and e were used and their mirrored variants. This piece was produced in C-major.

yamlExample 3. Fractal Music

I have used only π, e or their derivates till now to create music. In this example I will use fractals to generate the melody and π and e for the duration of the notes. Below are shown the fractals being used:

The Julia fractal

The Lorenz fractal

The Martin fractal

The Popcorn fractal

Fractal music

I have used the fractals shown above for the melody of each voice. This piece was produced in C-major. The first piece was produced using synthesizer sounds, the second using strings. You can download a .ZIP file containing the examples of this page including the used .TMG files.

Back to table of contents