This blog has moved

This blog is now at http://www.celesteh.com/blog

Tuesday 22 April 2003

Tuning (or Math Is Hard)

I'm readin Harry Partch's Genesis of a Music to try to find out how this just intonation thing works. Briefly, Just intonation is "natural" tuning based on ratios. Think of a guitar string: if you divide it in half, you get an octave. If you divide it by three you get a fith (sort of). All tunings until recently were based on fractions. Then we switched to irrational numbers. So your piano is now tuned irrationally. (I always suspected as much.)

Harry Partch's book is out of print. This is not actually shocking. The first section is a history of opera and vocal music from Plato through the early twentieth century, seen as a fight between those who think notes out to mirror words and those who think words ought to be bended or exaggerated to fit notes. There are definitely bits of wisdom in there, but my goodness, it's not an easy read. He certainly has a liking for five dollar words. Why use a short word when a longer one will do? His thesis (whatever it is) becomes a victim of unintended irony. The notes ought to be working for the words, but with the words he uses, I think Webster's dictionary is driving his writing. Or maybe he studied for the GREs much harder than I did.

Then comes the mathematical part. I foolishly thought I had some idea of just intonation because of a computer program I wrote around fifth or eigth grade. I had programmed the computer (in BASIC, of course) to play several Christmas Carols. But I thought it would be cool if I could program it (in BASIC) to write new songs and play them. This started very simply: playsound(random(), 2); play a "random" pitch for two miliseconds. This is, incidentally, the sound played by the computer game Gauntlet when you exit a level. My brother was kind of excited. But it's not really very musical, so I decided to generate arpegios.

An arpegio is a "broken chord." It is all the notes of a particular chord played sequentially instead of all at once. An arpegio on C would play C, then E, then G, (then maybe high C followed by G,) then E, then C. Do Mi Sol Mi Do. My program picked a pitch in the scales that we're used to (A= 440 Hz) and generated an arpegio on top of it using fractions. Let $N be the starting pitch. $sol = $N * 3 / 2; This is easy to deduce because of the overtone series on a brass instrument. (I'm ignoring transposition here.) The pedal tone on a trumpet is C. The low open note on a trumpet is C, one octave higher. The next open note is G. A pedal tone is a note that isn't usually played as it's too low and hard to produce. The wavelength of a pedaltone is equal to the length of the horn. The low open note, one octave higher, has a wavelength equal to half the length of the horn. The next open note is one third of the length of the horn. The next note, another octave of C, is equal to one quarter the length of the horn. All open notes on a trumpet or baritone or tuba or whatever have a whole number relationship to the length of the horn.

The frequncies are related by the same whole note ratio, but inversely. The first open note (above the pedal tone) uses half the horn and is double the frequency (in Hz). The next open note uses one third of the horn and is triple the frequency of the pedal tone. So it you had a brass horn where the pedal tone was A (220 Hz), the first open tone would be 440 hz (the note A) and the next open tone would be 660 Hz (the note E). Ok, now, see how A is both 220 and 440? It's also 110 and 880. Every octave is a doubling of frequency. If you want to find a pitch one octave higher, then you multiply by 2. If you want the octave lower, you divide by two. This sounds right. If your piano is perefctly in tune, every A on it will be double the frequency of the A below and half the frequency of the A above. If you could see the sine waves, they would line up exactly and be perfectly in tune with each other.

Ok, back to my arpegio program from my youth. The fifth note in the major scale, Sol, is the second open note on my trumpet and the frequency is equal to three times the pedal tone. So if you take the first note of your arpegio and mutiply the Hz by three, you get a fifth, but it's one octave too high. Ah, but we can lower it one octave by dividing the frequency in half. So $sol = $n * 3 / 2; Yay!

I also figured out the third and was able to play arpegios with wild abandon. I'd pick some pitch from an array that contained the Hz for one octave to the Equally Tempered Scale, generate an arpegio on top of it, then pick another pitch from the same array and then play an arpegio on top of it, then pick . . .. I really liked infinite loops. My favorite command in BASIC was "goto."

And so, with great anticipation, I started up my program and the first arpegio sounded great, but the on the next one, the first note sounded . . . off. And on the next one, the first note sounded terrible! What was going on?

Luckily for me, my father had designed an electronic organ only a few years earlier. (He wasn't great for camping trips, but man, he was 100% there for technology explainations, even if he couldn't quite manage to disuade me from my goto obessision, he was great for helping me debug stuff.) The problem? Mixing tuning systems! things that sound "right" in fractional, just intoned systems, sound really really right. But it has some problems. Everything is tuned perfectly to the starting pitch. But if you switch keys, without retuning, everything sounds off. All the distances are perfect from C for the notes in the C scale, for example, but the fractions are off from what they ought to be if you start playing in D. Take my word for this, I don't have a soundfile to illustrate it, nor the math to work it all out here. But this a problem in tuning, for every tuning, is that the tuning can only be perfect in one key at a time.

this was "solved" with equal temperment. everything in equal temperment is equally out of tune. Tuning is based on irrational numbers instead of re-tweaked fractions. All the octaves in equal temperment are perfect. Everything else is off. If you have pitch N, to figure out the pictch one semitone above N (remember that there are twelve "semitones", or "half steps" or distinct piches in every octave), N[m+1] = N[m] * (1 + N[m] *2^^(1/12)); or, more generally, N[m+x] = N[m] * (1 + N[m] *2^^(x/12)); Got that? It's irrational. It's logarythmic. All the thirds sound kind of wrong. It's lead to all sort of dissonance and twelve-tone systems and post-diatonic harmony and hell, post-tuned music like noise. Or maybe all the debauchery would have happned anyway. But you can see how fractions are a LOT easier to think about.

which brings us back to Harry Partch, whom I am reading to better understand tuning, so I can do perfectly just intoned, tuned works for computer. Because the computer can re-tune instantly, should a key change be required. Also, there's no reason why the octave need have twelve tones in it. It could have thirteen, or twenty, or five. And with a perfect understand of these fractional systems, I could write even more music-producing computer programs, but not in BASIC and with fewer GOTO staements (you can see that this has been a work-in-progress for a long time.)

So you'd think, with my (admittedly, minimal) experience with just intonation, I would be able to get something out of this book. This is what it says:

In the ratio 3/2, 2 represents 1/1, the lower limit of the 2/1. the tone at the upper limit of the 2/1 may be represented by 4 (a doubling of 2); hence the interval from the 3 of 3/2 to this upper limit of the 2/1 is the interval from 3 to 4, or 4/3, which is therefor the complement of 3/2 within the 2/1; the two intervals might be expressed thus: 2:3:4. . ..

ummmmmm  yeah  ummmmm  I have no idea what that says. Not even a little clue. It cuold all be in German, for what I can understand of it (disturbingly, I have forgotten all of my German...). Maybe I should stick to equal temperment. Or to noise.

No comments:

Commission Music

Commission Music
Bespoke Noise!!