# Fractals and Music

Most musicians have seen fractal images-those hauntingly beautiful pictures generated through mathematical equations. But how many people are aware that the same equations can be used to create hauntingly beautiful music? This article will explore fractals and discuss how they can be employed in musical composition. The technique is so versatile that you can use it to create music in any style, and it has great potential for adding an exciting new element to your music.

Studying music from a mathematical point of view is nothing new; it dates back to ancient Greece. Around the fifth century B.C., Pythagoras uncovered mathematical relationships in music, in which musical intervals are represented as ratios of whole numbers. For example, the interval of an octave would be represented in the Pythagorean system as a 2:1 ratio because the frequency of the higher pitch is twice that of the lower. By the same system, the interval of a fifth would be 3:2, a fourth 4:3, and so forth. Other systems relating music to math have been developed, mainly in the 20th century. Among the many examples are Joseph Schillinger's System of Musical Composition and a method of composition developed by Olivier Messiaen in the 1940s. The more recent discovery of fractals and particularly their link to music has opened a door to composers, behind which lies immense creative possibility.

**WHAT ARE FRACTALS?**

Fractals are visual representations of certain mathematical functions, which show increasing detail upon magnification. A very important phenomenon of fractals is that they manifest self-similarity at all scales. Benoit Mandelbrot, one of the fathers of fractal geometry (and the man who coined the term fractal), loosely defines fractals as "shapes that are equally complex in their details as in their overall form. That is, if a piece of a fractal is suitably magnified to become of the same size as the whole, it should look like the whole, either exactly, or perhaps only slightly deformed."

One would expect that the construction of such complex shapes would require complex rules, but in reality, the algorithms (equations) that generate fractals are typically extraordinarily simple. Their visual results, however, show great richness. The seeming paradox is easily demystified: these algorithms involve "loops."

The key to the richness of detail that fractals exhibit is something that mathematicians call iteration. Most equations that we learned in school are linear-that is, the input is proportional to the output. For example, the equation x2 - 1 = 0 is a linear equation. The equations that generate fractals, however, are nonlinear. Nonlinear equations involve iteration, which means that the solution of the equation is repeatedly fed back into itself. It is an arresting thought that something produced from a purely mathematical procedure can be so aesthetically pleasing (see Fig. 1).

**FROM FRACTALS TO MUSIC**

The secret behind fractal music involves something that mathematicians call mapping. Mapping means creating a direct relationship between the numerical output of an equation and certain parameters that can employ that output. Fractal images, for instance, are produced by mapping the output of equations to colored screen pixels. The parameters in fractal music are sonic rather than visual and can include pitch, rhythmic values, and dynamics. This mapping process is the link between the worlds of numbers and sound.

The mapping of nonmusical material to pitches is another ancient idea. A medieval technique known as soggetto cavato (a theme "carved" from words) maps the individual letters of words to music. For example, Hercules Dux Ferrarie, a mass by Josquin des Prez dedicated to Hercules, Duke of Ferrara, uses a theme based on the vowels in the Duke's name. The sequence of vowels e-u-e-u-e-a-i-e is first mapped to the six solmization syllables (ut, re, mi, fa, sol, la), which generates the following syllables: re, ut, re, ut, re, fa, mi, re. When converted to traditional note names, one gets the pitches, D-C-D-C-D-F-E-D. This technique has been used extensively by composers throughout history, including J. S. Bach.

There is no single way in which to map numerical output to music; in fact, different mappings can be applied to the same numerical output. For instance, the output of fractal equations can be mapped to different note sets, and the resulting melodies will differ accordingly.

To illustrate how this mapping process works, let's analyze one of the most fertile algorithms: the Morse-Thue sequence. This number sequence, although relatively simple to construct from a mathematical standpoint, shows many interesting properties, including self-similarity. It is generated by the nonnegative integers 0, 1, 2, 3, 4, 5, 6, and so on, expressed in binary notation (base 2):

0 1 10 11 100 101 110 111 1000 1001....

Now, add the digits of each term in the sequence, yielding

0 1 1 2 1 2 2 3 1 2....

Notice that if you take out every other number (keeping the underlined ones), you get back the same sequence:

0 1 1 2 1....

So how do you turn all this into music? That is where mapping comes into play. One way is to map the numbers to a scale. If C major is to be our scale, then the note C would be mapped to the number 0, D to 1, E to 2, F to 3, G to 4, and so on. This mapping results in the melody shown in Figure 2a. Notice that, if you remove every other note in the melody, what remains is the same melody as the original (see Fig. 2b). If you repeat this procedure with the already truncated melody, the result is no different (see Fig. 2c); the melody is self-similar.

You are not restricted to base 2; using a different base yields different melodies. You can also map the numeric values to other scales or groups of notes to get different results. To make things even more interesting, you can multiply every term in the sequence by a constant value. This can produce curious results, depending upon which combination of base/multiplier you have chosen. A very fruitful combination, for example, is base 2 and multiplier 33. Mapped to a C major scale, this combination produces the melody shown in Figure 3.

The characteristics of these "fractal melodies" are mind-boggling. If you analyze them in detail, you will find all types of self-similarities and interrelationships among the pitches, and because there is an infinite range of numbers to choose from, you have an inexhaustible source of melodic subject matter.

Other algorithms can be mapped to musical parameters in a similar manner. Every algorithm generates a unique set of melodies, but each has its own unique "fingerprint," even when different mappings are applied. Many of the programs mentioned later in this article automatically compute the entire mapping process, making it transparent to the user. This allows musicians to focus their creativity exclusively on musical questions. Little or no math background is needed to learn most fractal software.

Of course, as with any other "system of composition," it is ultimately the composer's musical talent that determines the quality of a piece of music; plugging in some parameters and pushing a few buttons is not going to produce a masterpiece. In the hands of a skilled composer, however, fractal music can serve as a source of inspiration and as a tool for raw musical material, which can later be developed, incorporated, and refined.

**NOW IT'S YOUR TURN**

Many fractal music programs are available today, and you'll be surprised how powerful some of them are. Many programs are freeware or shareware that will get you started quickly in fractal music composition. What follows is a short description of some of the most interesting fractal music programs on the Net. Some of the Windows programs listed require the Visual Basic Runtime Libraries, which you can obtain from www.softseek.com/Utilities/VBRUN_Files.

FractMus (Windows 95/98/NT). My own program, FractMus 2.5, is very easy to use and allows you to choose from ten well-known note-generating algorithms, including the aforementioned Morse-Thue sequence (see Fig. 4). You can assign different algorithms to all 16 MIDI channels independently. The program has 15 predefined scales and allows you to create your own. Other features include predefined rhythmic values (along with user-defined ones), inversion of melodies, modulation, tempo change, time signature, stereo effects (panning), and full percussion support. It also includes a Composition Maker and a Composition Randomizer, two tools that help you create your compositions almost effortlessly.

With FractMus you get immediate results: the music is computed and played in real time. The program writes Standard MIDI Files from your compositions, allowing you to load them into your favorite sequencer or music editor for further manipulation. In addition, FractMus translates your compositions into fractal images. It comes with complete documentation and dozens of example files created by me and other users. The program is very flexible and will let you create music in any style you can think of, from minimalist to stochastic. It's great for commercial music, too. Last but not least, the program is free. You can download it from my home page at www.geocities.com/SiliconValley/Haven/4386.

A Musical Generator (Windows 95/98/NT). A Musical Generator 1.2 by MuSoft Builders is another worthwhile program. It draws musical material from many sources, including complex maps, mathematical constants (such as s), images, text, and user-provided data. The program is very well documented and has an easy-to-use interface. It also includes several sample files and tutorials. The program writes Standard MIDI Files and is distributed as shareware. You can download it from MuSoft Builders' home page at www.musoft-builders.com.

Art Song and MusicLab I: Music from Chaos (Windows 95/98). These shareware programs by David Strohbeen use iterated function systems and quadratic functions to create strange attractors from which the music is derived. They can also transform graphic images into music. A large number of musical parameters are user-adjustable, allowing you to create different musical styles. In addition, you can change these parameters at any time during the compositional process. Each of these programs generate standard MIDI files, and you will find full online documentation. You can download Art Song and MusicLab I from members.aol.com/strohbeen/fmlsw.html. You'll also find links to other fractal music software at that site.

MusiNum (Windows 3.1). Lars Kindermann's free program generates MIDI files using the Morse-Thue sequence exclusively. The user controls musical parameters such as instrument, scale, and duration. The program is easy to use and well documented. You can download MusiNum from www.forwiss.uni-erlangen.de/~kinderma/musinum.

LoShuMusic and FibonacciBlues (Macintosh). These two Mac shareware applications use the Fibonacci sequence and aleatoric procedures as a basis for music generation. You can download them from ftp://mirror.apple.com/mirrors/Info-Mac.Archive/art/fibonacci-blues-02.hqx and ftp://mirror.apple.com/mirrors/Info-Mac.Archive/art/loshu-music-02.hqx respectively.

Symbolic Composer (Macintosh). Symbolic Composer is a commercial program that uses a proprietary language of 700 building blocks to compose. It lets users apply a wide range of algorithms to most musical parameters. This program is not particularly easy to use or learn, but in the hands of a skillful composer, it is one of the most powerful tools for experimental music. You can download a working demo of the program from symcom.hypermart.net.

Csound (all platforms). Along with its many other talents, the Csound programming language can be a good vehicle for trying out experimental mappings of data to sound parameters, such as those used in fractal music. In fact, Csound wizard Hans Mikelson has just published some fascinating Csound files that use different elements of fractal graphics as parameter values for Csound instruments. For example, one of Mikelson's files uses the number of loops in the image to determine the spectrum of his sounds, and another maps RGB values of a color image to the frequency domain (did someone say "MetaSynth"?). You can read about the process at www.werewolf.net/~hljmm/Ezine/synthesis. Note EM associate editor Dennis Miller's fractal image on the cover of the summer Csound 'zine.

I hope that this survey will give you an incentive to explore the vast realm of fractal music. Regardless of the musical style in which you work, fractals can be a great way to generate new and interesting material.

*Gustavo Diaz-Jerez is a concert pianist, composer, and computer programmer. He is a graduate of the Manhattan School of Music in New York, where he is currently pursuing his doctorate in musical arts.*

These are my comments.