Simple Algorithmic Composition

There are a number of different ways of creating fractal music, but all of them are forms of "Algorithmic Composition". Algorithmic Compositions rely on (not surprisingly) algorithms to determine the features of a song. In simple cases, an algorithm may be used to determine what notes should be played in what order. More complex algorithms may also provide a means to specify the velocity (or volume) of a note, the speed with which it is played, and the duration for which it is held.

Random Music

An example of a simple (non-fractal) music-writing algorithm might use a standard random number generator. The numbers generated would then need to be mapped to musical notes. A very simple method for doing this might be to take the random number, and mod it by 88. If we numbered the keys on a piano from bottom to top, the value from our calculation can be mapped directly to a key on the keyboard. Of course, assuming our random numbers are evenly distributed between 1 and 88, the pitches we generate are going to tend to bounce around a lot on the keyboard. The "music" produced using the random number generator will sound exactly like one might expect - like someone hitting random notes on a keyboard. The Java applet below demonstrates this method of generating pitches.

We can improve the results from our algorithm by changing how we assign the generated numbers to pitches. Notes in a typical song don't tend to be evenly distributed - rarely does one see a jump of as much of an octave, and more often than not, a note will be within a third of the notes that come before and after it. If we use our random numbers to somehow specify a note within a small range around the previous, we'll get something sounding much more melodic, even if it's not quite on the same level as a Bach invention.

We can also make our music a little more pleasing to the ear by limiting the notes chosen to those in a particular key (major or minor). The applet below uses random numbers to determine where to move in relation to the previous note, and limits itself to a range of two octaves of a major key.

While both of these examples use non-fractal techniques for generating numbers, the ideas used to map the numbers to pitches are also commonly used in generating fractal music. The examples that follow will use a combination of the two techniques shown here.


Home | Fractal Music