# “Dancing with Fractals: The Chaos Game (with Music!)"

### jointly presented by

 Cynthia Church (Bishop Strachan School) and Dr. Randall Pyke (University of Toronto & Ryerson Polytechnic University

## If one assigns musical notes to parts of the fractal, then we can also listen to the chaos game as the points move around on the fractal. Different fractals sound differently!

*************************************

Here is a link to Randall's Chaos Game applet:
http://www.math.toronto.edu/~pyke/mat335/Fractal.html

Here are some notes and links you might want to check out:

********************

Written by Cynthia Church

jointly presented with Dr. Randall Pyke

for SIMMER March 30th, 2000

1            Introduction:

Mathematics and Music are closely connected in many ways.  For example, rhythm can be easily described using fractions.  Pitches can be represented by real numbers.  Chords can be represented by the addition of integers.  In the 20th century, musical composition using mathematics by the help of computer programming began to evolve.  These types of compositions are called Algorithmic Compositions.

A more spiritual connection between the study of Mathematics and of Music is the search and the love for beauty and the sublime in both disciplines.

In Beethoven's 7th Symphony, there is a march pulse that is a feature of the entire symphony, it was described as the "austere beauty of the scoring" in Herbert Von Karajan's performances. Beethoven once announced to Bettina Brentano, who wrote to Goethe about her meeting with Beethoven, regarding his 7th Symphony:  "When I open my eyes, I must sigh. I must despise the world, which does not know that music is a higher revelation than all wisdom and philosophy…. Music is the wine which inspires us to new generative processes and I am the Bacchus who presses out this glorious wine to make mankind spiritually drunken.".

Einstein once described the concluding Rondo "alla turca" in Mozart's piano sonata in A KV331, as a "true scene di ballet.

University of Alberta mathematician Robert Moody said in a letter supporting Prof. Harold Scott MacDonald Coxeter's nomination for an honorary doctorate at York University (presently a professor at University of Toronto),  " Modern science is often driven by fads and fashions, and mathematics is no exception. Coxeter's style, I would say, is singularly unfashionable. He is guided, I think, almost completely by a profound sense of what is beautiful."

In the book "Emblems of Mind: The Inner Life of Music and Mathematics, (1995)".  There's a passage that captures the search for the sublime in both disciplines:

"... The search of the sublime links Music and Mathematics. Both arts seek something which combined with the beautiful provokes both contemplation and restlessness, awe and comprehension, certainty and doubt.  The sublime in mathematics and music sets the mind in motion, causes it to reflect upon itself.  We become aware first, in humility, of the immensity of the tasks of understanding before us and the inability of human imagination to encompass them.  The sublime inspires an almost infinite desire, a yearning for completion which is always beyond our achievements of reason in having brought us so close to comprehending a mystery fated to remain unsolved."

The following Algorithmic Compositions use the properties of the Sierpinski Triangle.  These types of algorithmic compositions are also known popularly as "Fractal Music".  Fractal Music is a musical piece composed using fractal mathematics by means of computer programming.  They are presented in the order listed below at SIMMER on March 30th, 2000.

2          The "Compositions":

2.1            Sierpinsky # 1: By Cynthia Church  (first composed on June 1999, last revised on 12th Dec 1999)

2.1.1    The Chaos Game:

One method of generating the Sierpinski triangle is by using the Chaos Game.  The Chaos Game goes as follows:

1.      Fix 3 points on a plane.  These points are the vertices of the triangle

2.      Randomly choose one point within the triangle bounded by the 3 fixed points.  This is your current point

3.      Randomly choose 1 of the 3 vertices

4.      Determine the midpoint of the line between the chosen point and your current point.  This midpoint now is your current point

5.      Repeat step 3 to 5 about 3000 times

2.1.2        Notes on the Chaos game:

§              After around 3000 iterations, one can see that the points (which seems to be randomly generated) create a specific pattern, known as the Sierpinski Triangle.

§              The Chaos game is a good example of one property of Chaos Mathematics: that patterns exists within chaos.

§              The Sierpinski Triangle is called an attractor (of an IFS); see below.

2.1.3        Mapping to musical notes in Sierpinsky #1:

Each current point that is created in the Chaos Game two real numbers (x,y).  In Sierpinsky #1, both these numbers are mapped to midi notes.  The midi notes are played in real time when the chaos game is preformed.

(MIDI is the digital note for music.  The MIDI notes runs from 0 to 127.. a total of 128 notes. The lowest C is given by 0, C# is 1, D is 2...etc)

2.1.4        Notes on Sierpinsky #1:

Our eyes perceive objects very differently from the way we hear things.  In the Chaos game we see the Sierpinski triangle form as the game proceeds.  However, we could not "hear" the triangle form no matter how long we listen to it.  Sierpinski #1 sounds totally random, with no particular melody.

2.2            Sierpinsky # 5: By Cynthia Church  (first composed on 3rd Oct 1999, last revised on 3rd Oct 1999)

2.2.1        IFS programme: (ref: Barnsley pg. 88-89)

Another way of generating the Sierpinski Triangle is by a deterministic algorithm called an IFS (Iterated Function System).  Sierpinsky #5 is an alteration of the deterministic algorithm in Barnsley's book pages 88,89.

2.2.2        Mapping into musical notes in Sierpinsky #5:

Each point created by the deterministic algorithm is mapped to  (midi note mode 48) +50. This keeps the notes within 4 octaves so our ears can perceive them easily.

2.2.3        Notes on Sierpinsky #5:

§              In Sierpinsky #5, the visual and the audio match very well together.  One can predict how the borders of the triangles are drawn as well as how the musical notes are played.

§              This piece does not sound random at all.  It is very predictable.

§              However, it's not a pleasing piece at all.  As a matter of fact, it sounds more like sound effects than music.

§              The piece does sound more interesting after a few more iterations

2.3            Sierpinsky # 4: By Cynthia Church (first composed on 22nd Sept 1999, last revised on 3rd Oct '99)

2.3.1        Method of elimination:

1.      Take a solid triangle.

2.      Divide it into 4 equal parts (with the middle part being an upside down triangle)

3.      Eliminate the upside down part in the middle

4.      Recursively do steps 2 to 4 for the remaining right side up triangles infinitely many times

5.      You'll end up with the Sierpinski triangle

2.3.2        Dimension of the Sierpinski Triangle:

§              The elimination method clearly shows the fractional dimension of the Sierpinski Triangle.

§              Fractal objects are objects that have fractional dimensions

§              The Sierpinski Triangle has a dimension between 1 and 2.  Specifically, its dimension is approximately 1.58.

§              Details of calculations on Fractal Dimensions can be found on Chapter 5 of "Fractals Everywhere" by M. Barnsley.

2.3.3        Mapping idea behind Sierpinsky #4:

Sierpinsky #4 applies the method of elimination to the concept of a triad in music.  The basic triad is C E G (or "do me so" if you were to hum it out).  Apply the procedure of eliminating the middle of the triangle recursively to the triad CEG and one gets the following lists of notes

C E G   (my first triad)

C   G   (eliminate the middle note 'E')

C E G   G B D   (expand the C and G into 2 triads)

C   G   G   D   (eliminate the middle of all the present triads)

C E G  G B D  G B D  D G# B (expand into 4 triads)

C   G    G   D    G   D    D    B (eliminate the middle of all present triads)

etc.

Now apply the mapping of the above keys to the MIDI notes

Hence the piece in terms of numbers from 0 to 127 looks like this

0 4 7

0    7

0 4 7  7 11 14

0    7  7    14

0 4 7  7 11 14  7 11 14  14 18 21

0    7  7      14   7    14    14    21

0 4 7  7 11 14  7 11 14  14 18 21  7 11 14  14 18 21  14 18 21  21 25 28

0    7  7      14  7      14  14      21  7     14   14      21   14    21    21    28

etc..

2.3.4        "Discovery" when "composing" Sierpinsky #4:

If you count the none eliminated numbers in each alternative rows,

you get the Pascal triangle!! See below

Count the number of multiples of 7's

0 4 7

0   7                                                  (one 0 one 7)

0 4 7  7 11 14

0    7  7      14                          (one 0 two 7 one 14)

0 4 7  7 11 14  7 11 14  14 18 21

0    7  7      14  7      14  14      21                      (one 0 three 7 three 14 one 21)

0 4 7  7 11 14  7 11 14  14 18 21  7 11 14  14 18 21  14 18 21  21 25 28

0   7  7    14   7    14   14    21   7    14   14    21   14    21   21    28   (one 0 four 7 six 14 four 21 one 28)

2.3.5        Notes on creating Sierpinsky #4:

§              One could use a recursive programme to generate the multiples of 7.  That was the method I used for Sierpinsky #2 but it never worked.

§              With the "discovery" above, Sierpinsky #4 was created using the Pascal triangle as my predefined notes.

§              Each line of the Pascal triangle is run sequentially from left to right.

§              Each number, x,  in each row is mapped to the midi note (x*7 mod 128), with a loudness of (x mod 70)

§              The audio effects captures the elimination process of the Sierpinsky Triangle, but it's still not quite a pleasing piece yet

2.4            Sierpinsky # 3: By Cynthia Church (first composed on 22nd Sept '99, last revised on 26th Sept '99)

2.4.1        More connections between the Pascal Triangle and the Sierpinski Triangle:

The connections between the Pascal Triangle and the Sierpinski Triangle can be found in pages 82-88 and chapter 8 of "Chaos and Fractals: New Frontiers of Science", by H-O Peitgen, H Jurgens, and D Saup

2.4.2        Sierpinsky #3:

§              Sierpinsky #3 uses the connection that is described on page 88 of the book by Pietgen et. al. mentioned above

§              Each line of the Pascal triangle is run sequentially across from left to right

§              Suppose x is the current number in the Pascal triangle we're looking at

§              If  x mod p = 0 for some chosen integer p defined by the programme, then

play a long midi note (x mod 48 + 50)

§              If x mod p not= 0, then play a short midi note (x mod 48 + 50)

§             Most people like it and consider it a musical piece

§             Success as a musical piece:  It has rhythm, emotions, the melody is repeated with different durations

§             This piece is now on sale at MP3.com with the help of Phil Jackson on Sound Module and Audio

Processing using AudioMulch

3                    Lists of references and interesting web-sites:

3.1            Reference books:

1)      "Fractals Everywhere" by Michael Barnsley

2)      "Chaos and Fractals: New Frontiers of Science" by H.O. Peitgen, H. Jurgens, D. Saupe

3.2            Interesting web-sites on fractal music:

- This is the home page that two grade 12 gifted students from Mary Ward Catholic Secondary School that I've worked with, Stefanie Blaine and Jason Montojo.  (My thanks to their gifted teacher David J. Church for bringing us together for the project)

- This is the home page of Phil Jackson.  The person who helped me using Audio Mulch for my Sierpinski #3.

- This is the home page of Jose Oscar de Marques. The first fractal music site that I've visited and the first person I've talked to about fractal music.

- This is the home page of Daniel Cummerow.  He has a similar philosophy and approach to fractal music as I do.

- This is the home page of Phil Thompson.  He helped me with my VB codes at one point to change them to midi files.

- This is the home page of CNfractal_music forum.  An e-group that I'm a member of.

3.3            Interesting web-sites on Prof. Coxeter:

- This site is from University of St Andrew Scotland.

- This site talks about Prof. Coxeter and Escher's arts.

3.4       Course homepage of Dr. Randall Pyke at University of Toronto

3.5       Web-site where you can purchase the CD "Generative Soundscapes I"

********************************************************
You will need to have Acrobat Reader on your machine to enable you to read/print PDF files.