Let’s say you’ve got a simple melody. How might a person come up with a simple set of chords that could played along with the melody to enrich the sound without the result sounding boring (or simply awful)? This is the vaguely-stated “problem of musical harmony,” and despite my having examined many musical theory books in a desultory way over the years, I’ve really made little progress in reaching a simple understanding of it. Then today I found this entertaining page on “Kraehenbuehl’s algorithm” in Donald E Knuth’s Selected Papers on Fun and Games:

In the article, Knuth explains: “More precisely, I’ll show you how to produce 2^n+ 2^(n-1) different harmonizations of any n-note melody, all of which are pretty good,” and illustrates the technique by taking the melody of “London Bridge is Falling Down” and harmonizing it using “random” choices taken from the binary expansions of pi and two other mathematical constants. Fascinating!




