Thursday, April 24, 2008

The Sound of Music

Yet another in a series of deceptively named posts (see "VM Wear" for another example).

I've started trying to write a fugue generator, which is only slightly more complicated than actually writing a fugue. I picked fugues because they are a fairly well defined composition, and they are marked by repetition, both of which I thought would make writing this a snap. Oh, how wrong was I.

First, fugues aren't well defined at all. About the only characteristic that people can agree on is the use of repetition, and even then there is still some confusion. Second, having to make a generator that tries to actually sound like an actual existing form of music is a pain, particularly if you try to use existing musical conventions.

Musical conventions are pretty complicated. So far I've dedicated several days to translating music theory into Markov chains and other structures, and still really don't have any product to show for it. However, I have simultaneously leaned a lot about Markov chains and music theory, which is good. Markov chains are pretty straightforward; music theory is a tougher nut.

Music theory is built on centuries of previous generations methods and notation. The notation is interesting, because the existing notations doesn't fit what it is supposed to represent cleanly, or rather it doesn't scale nicely from playing to theory. Chords and interval notation and the rest seem kinda hacked together. When playing with intervals, all sorts of weird things can happen. When you are building chords you end up with a fair number of exceptions and changes. I feel that much of this has to do with using a just intonation rather than a tempered scale. The primary difference between the two is that tempered scales use equal divisions between the notes, and just intonation tries to use the smallest whole number ratio between notes. That being said, I've decided to throw caution to the wind and use a tempered 19 division scale for my generator. (Most music is played in a 12 division scale using just intonation.)

I like this better, because the ratios are relative to any two notes' frequencies, and the consonance/dissonance between the notes can be expressed mathematically. This simplifies writing the progression algorithm, as I could simply base it off of numerical consonance, rather than having to translate music theory into probabilities and conditionals. With basic bounding and checks for repetition, even a random walk should be less dissonant in 19 as compared 12.

The reason that I can chose a 19 tone scale is purely digital, or rather a lack thereof. I don't have to play an instrument in this scale, the computer does. traditionally, instruments have been limited by the number of fingers its operator has. 12 divisions is a good compromise between playability and consonance, whereas 19 would be a bit harder to play.

Stay tuned for further developments, hopefully I'll have a working system shortly.

Robert Alverson


No comments: