MathOverflow is a question and answer site for professional mathematicians. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let me apologize first as I see this may be way off topic. Still it is a really fun question I've been meaning to ask a few fellow grads/faculty members, and so I think it's worth a shot here.

I'm interested in suggestions for using math formulas or concepts in coding algorithmic music.

In Stephen Cope's Workshop in Algorithmic Computer Music in 2004 I was introduced to the art of algorithmic composition, through coding LISP to generate midi compositions, frequently using markov chains to weight transitions, from the large scale harmonic progression and rhythmic structure to the individual notes and their time values.

We played a bit with simple math functions for generating simple pieces. One of these I wrote "sonified" the towers of Hanoi. The movement of the kth largest disk generated a bleep of frequency N(2/3)^k, for N some (high) starting frequency. Since 2/3 is roughly the ratio to get the next lower 5th, the I was able to stay roughly in the 12 tone equal temperament, while superimposing the same pulse at (2/3)^k the (tempo and wave) frequency. The piece wasn't particularly interesting musically, but conceptually fun.

In the workshop many other math themes are explored such as cellular automata, genetic algorithms, Brownian motion. I've been thinking since about interesting curves on the orbifold $T^n/\Sigma_n$ ($n$ continuous voices modulo the octave and modulo their labeling), and also about energy functions which give harmonic progressions as geodesics. (Perhaps harmonic functions would be applicable here, after all!)

I wonder what specific examples others have for making interesting pieces of music (art), or vague examples for that matter.

I'm happy to close this off, too, if no one is interested. Sorry for the softy.

share|cite|improve this question
Check out the Journal of Mathematics and Music: , also look at the list of editors, look up their home pages and see what they're up to. There's plenty of responses to your question in there. – Ryan Budney Dec 1 '10 at 6:13 might be of interest as well. – J. M. Dec 1 '10 at 6:31
I have a score for Fermat's Last Fugue, but the character limit for this comment is too small to describe it. (Sorry, someone had to say it.) Seriously though, a long time ago my friend came up with an audio-visual demo of the towers of Hanoi with 7 disks on his computer. It was impressive to me at the time, but for "sonification" he just had a simple scale. I suggested instead (least significant bit to most significant bit) A-B-E-F-C(up octacve)-D-A(down octave). Second voice (rest)-E-A-A-G-B-A. Third voice (rest)-(rest)-C-D-E-G-C. The song still sticks with me as a binary count mnemonic. – Daniel Mehkeri Dec 5 '10 at 19:19

Sonic versions of sorting algorithms have long been used to help students gain an intuitive feeling for the differences between the algorithms (say, insertion sort vs. bubble sort), including their running times. When combined with visuals, the impact is quite dramatic. Here is an example at Synth Music and Electronics.

share|cite|improve this answer

There is Per Norgard's "infinity series" which he used in his Symphony no. 2.

share|cite|improve this answer

I messed around with this when I was a C++ TA. I came up with "musical sorting algorithms", "musical Gauss Seidel" and a terrible sounding FFT. Details:

share|cite|improve this answer

A few years ago, Dylan Thurston programmed the following for me (he did it with Haskore).

Take a 1-dimensional aperiodic tiling (Penrose tiling?) and reproduce it in the times axis. Here's a link to the sound file: I sounds like:


where (short)=1 and (long)=golden number.

I then made some feeble attempts at composing something that follows that basic rythm.

share|cite|improve this answer
It's a great idea. Unfortunately I've tried to open it in 2 browsers, and get error, does the file open for you? – AndrewLMarshall Dec 7 '10 at 8:27
Is this different than a random sequence of 1's and $\phi$'s ? That generated, say, by intersecting and irrational slope with the coordinate grid with 1 for horizontal and $\phi$ for vertical intercepts? – AndrewLMarshall Dec 7 '10 at 8:30
@AndrewMarshall: I made the file executable. Maybe that was the problem. @AndrewMarshall: Your description produces the same sequence of 1's and $\phi$'s. – André Henriques Dec 8 '10 at 21:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.