\section{Fractal Music}
How are fractals related to music?  Can a relation be found at all?  Many people who are interested in science are also interested in music due to its mathematical properties.  Quite a few people have wondered if they can apply their knowledge of music to the growing field of fractals.

Before we explore this topic, it is important to address exactly what ``music'' is.  Many people have preconceived notions of what music should be.  They think of Mozart and Beethoven, with complex interweaving melodies and harmonies.  Unfortunately, it has not yet been discovered how to write a program that performs some magic with numbers and fractals, and produces a fully scored piece for a symphony.  When exploring how to make music out of fractals, it is important to relax your view of what ``music'' is.

Since fractals have a strong basis in chaos, fractal music will often sound chaotic and lacking in rhythm, harmony, or discernable melody.  This will often clash with a person's preconceived notion of what ``music'' is, and so when they hear fractal-generated music, they will think, ``This isn't music.''  However, new-age composers are attempting to open up the field of atonal, arrhythmic compositions, and it is in this category that fractal music fits best.

Fractal music has some properties in common with the aleatoric compositions of John Cage.  Cage, who is most famous for his piece entitled 4'33 (4 minutes and 33 seconds of silence, in 3 movements), tried to open our ears to alternative forms of music.  His compositions were usually formed by utilizing chance events, such as flipping a coin, or by giving vague direction to performers and suggesting they ``do what they feel like''.  Cage claimed to be trying to open our ears to other forms of music that are all around us, such as the nervous coughing during a performance of 4'33.  Fractal music is a similar attempt to open our ears to a new form of music, and in this case, that music is derived from mathematical manipulations of fractal systems.  However, human involvement is still necessary to guide fractal music into a work of art.

The simplest form of fractal music is demonstrated at the Fractal Music Lab web site [Strohbeen 2000].  The music generation programs found on this site make use of the MIDI protocol, a well established method of designing computer generated music.  MIDI music is defined by a collection of numbers, each describing a different component of the music.  For example, you can specify the pitch, duration, volume, musical instrument, and many other musical parameters, each with just a number.  This is a completely natural playground for fractal-generated music.  One can simply map numbers found in a fractal to the different MIDI numerical components, and see what kind of music comes out.

One method of mapping fractals to MIDI musical data is through the use of an iterated chaos function, a concept at the heart of fractals.  First, a function and a starting value are chosen.  The function is applied to the starting value, and a new value is produced.  This new value is mapped to some component of the MIDI data, such as pitch.  Then the function is applied to the new value, and another value results.  This is repeated until the programmer decides the composition is finished.  At each step, the result of the function is used to specify a MIDI parameter, and also to generate a new value.

Another method to generate MIDI data from fractals involves manipulations of the graphical rendering of a fractal.  For example, there are programs written that will generate music out of the Mandelbrot set chosen by the user.  These programs rely on how computers represent images internally.  Recall that computers represent each pixel's color as three numbers indicating how much red, green, and blue light is mixed together.  A program will choose a set of points (usually by picking points on a line or on a user-defined path), and use the color values as MIDI parameters.

Other types of programs exist, and there are probably many other fractal music techniques just waiting to be discovered.  The concept is simple: just define an algorithm to take numbers generated from a fractal and map them to the parameters of a MIDI music composition.  

Those readers that program would be interested to know that the standard pseudo-random number generator software included with almost every computer is a form of iterated chaos function, which is a type of fractal.  The random seed that is specified at the start of the program is simply the starting value used in the iteration.  So, generating fractal music can be as simple as directing a computer to play ``random'' notes using MIDI.

\subsection{Example 1: Random note generator}
\label{sec:music:example1}

In Appendix B on page \pageref{source:fractalNoteGenerator}, you can find a listing for the program FractalNoteGenerator.  This is actually a pair of classes written in Java\trademark, FractalNoteGenerator and RandomFunction.  Those readers with programming experience in Java\trademark or other object oriented languages may be interested in reading the code.  

FractalNoteGenerator is a simple program that illustrates the most basic form of fractal-to-MIDI mapping.  The FractalNoteGenerator component implements the details necessary to construct and play notes every half second, for 20 seconds.  The notes it chooses to play are dictated by the numbers produced by an instance of class RandomFunction.  This object uses the built-in chaos function mentioned above, found in Java\trademark's Random class, which is an implementation of a pseudo-random number generator.  FractalNoteGenerator is designed so that any kind of chaos function can be used, but in this example, the pseudo-random number generator works quite well.

Instructions for running the program are included in the appendix.  The results of execution are a chaotic selection of notes that don't sound much like music, but perhaps a composer might hear a sequence of notes that he likes.

\subsection{Example 2: Random multiple note generator}
\label{sec:music:example2}

In Appendix B on page \pageref{source:fractalMultipleNoteGenerator}, you can find a listing for the program FractalMultipleNoteGenerator.  This builds on the FractalNoteGenerator, playing multiple notes at a time.  Instructions for running the program are included in the appendix.

This program attempts to make fractal-generated ``chords'' by playing up to three notes at a time.  The resulting ``music'' is dissonant, and very difficult to listen to.  Whereas a composer might be able to pick out a melody he likes in the previous program, this example is too hopeless to work with and illustrates some of the difficulties in writing fractal music programs.

\subsection{Example 3: Random chord generator}
\label{sec:music:example3}

In Appendix B on page \pageref{source:fractalChordGenerator}, you can find a listing for the program FractalChordGenerator.  This program extends the idea of the FractalMultipleNoteGenerator, but it follows basic chord construction rules so that the notes it plays together aren't dissonant.  However, it still makes no attempt to place chords together in such a way that a coherent melody is formed, or so that well-known taboos of music theory aren't broken.  

The music that comes out of this third example is a little less painful to listen to than the FractalMultipleNoteGenerator's music.  While it is still seemingly random in nature, it sounds a little more full than the FractalNoteGenerator's music.  More sophisticated techniques could be used, such as amplifying the soprano line.  This would mimic traditional classical music, in which the melody is found in the highest pitched voice.  Effort might also be made to try to organize chords in a slightly more coherent manner in line with traditional chord progressions.

\subsection{Adding human talent} 

Usually, the first two examples above generate music that sounds very chaotic and unorganized.  It can be interesting on its own, when you consider that you're ``hearing'' a fractal almost directly, but, as the second example shows, raw fractal notes don't exactly produce pretty music.  Instead, some artists use the sounds generated by techniques such as those above as a starting point in their compositions.  Usually, one of the most difficult parts about writing music is coming up with an idea for a major theme.  Given a theme, a practiced composer can fill out many voices with harmonies and variations on the theme.  Using common chord progression practices, the harmonization tends to fall into place after the initial creative inspiration of the melody.  The composer knows all of the rules of thumb of harmony and voice leading that make a piece of music sound like a coherent unit, as opposed to random ``chords'' like in the second example.  This is why the harmonies in the third example sound a little more like real music instead of randomly generated notes played together.

Using fractal music techniques such as those described above can help a music writer get over ``composer's block,'' giving him samples of music to work with.  Fractal music may offer him full-fledged themes, or it may give him a base to start on.  However, due to its chaotic nature, fractal music tends not to have harmonies and rhythms that appeal to our subconsciously conditioned sense of music.  In musical composition, only certain notes sound good together (``harmonious''), while others will clash against each other (``dissonant'').  Furthermore, certain sets of notes (``chords'') may work well together, but they won't sound right when played soon after other chords.  This is why it is not generally feasible to use fractals to generate fully scored music akin to Beethoven, because there is a very careful distinction between what sounds good and what doesn't.

A fractal music composer, however, can help guide the raw chaos of fractal-generated MIDI data into a musical composition that makes sense to our ears.  A painter does more than choose his paints carefully and then splatter them at random on the canvas; even Jackson Pollock had a careful method.  A fractal music composer uses the themes he hears in fractals and builds them up into full-fledged compositions with harmonies that make sense.  The resulting music is chaotic and at the same time more structured than the music generated by a program, and is much more interesting to listen to by people whose sense of ``music'' has been influenced by years of human-created compositions.