Fractal Music(?)

In the past, I have treated fractals visually. For instance, in my treatment of the Mandelbrot set, I chose points in the complex plane to represent pixels in an image, applied the iterative function \(z_{n+1} = z_{n}^2 + z_0\) to each of those points until the orbit escaped (or failed to escape after a fixed number of iterations), then colored the pixel based on the number of iterations applied before the orbit escaped. Another visual approach was to compute a large number of orbits and treat their traces like photons hitting a light sensor, thus creating nebulabrot images. I have recently started playing around with an entirely different idea: instead of using the orbits to compute values for pixels in an image, the orbits can be used to generate sound.

The approach that I have adopted here is fairly naïve, as my knowledge of music theory is rather lacking. That said, here is what I have done so far:

First, I pick a point in the complex plane and generate the orbit of that point. For instance, consider the point (taken arbitrarily) \(0.375+0.285i\). Iterating the Mandelbrot function 64 times gives us the following sequence of complex numbers, which represents the orbit of the original point:

To turn this into sound I divided the complex plane into 24 wedges, each of which is π/12 radians wide. Each wedge corresponds to a different note in a chromatic scale, hence each point in the orbit corresponds to a note. For the duration of each note, I used the distance from the origin with points closer to the origin having a longer duration. The exact details can be found in the program used to generate the music: fractal_music.py. You’ll need python and music21 to make this work.

Finally, just for giggles, I typset this sequence of notes using musescore. The result doesn’t look much like music, but is moderately entertaining.

Obviously, there are a lot of parameters here. In the code that generates these “tunes,” there are two obvious parameters: the initial point (the orbits can be quite different depending on what point is chosen) and the number of iterations (more iterations give longer pieces of “music”). There are also some not-so-obvious changes that could be made. Instead of looking at the points themselves, the note generated could depend on the change in position (i.e. the difference between two consecutive points in an orbit). The interpretation of phase and modulus could be exchanged, or the Cartesian (rather than polar) coordinates of each point could be used in some manner. If anyone plays with this at all, please let me know—I would love to hear the results.