[comp.sys.atari.st] Bach's "Well-Tempered Clavier" or whatever

jhs@MITRE-BEDFORD.ARPA (12/19/87)

> From: ucsdhub!jack!crash!pnet01!haitex@sdcsvax.ucsd.edu  (Wade Bickel)
>         Western music is based upon a 12 tone system...
>
>      ...Interestingly enough, the well tempered scale is not true to
>      the ear.  IE:  if I tune my guitar by ear to a given major scale,
>      it will sound fine in that scale, and its cousins, but degrades
>      with distance from the original root.  Clearly the well tempered
>      clavier (spelling?) is full of consistent distortions to make the
>      circle of 5ths fit.  At least I think this is so.  Any knowlegable
>      theory experts care to enlighten me?
>                                                 Thanks,
>                                                         Wade.
>   UUCP: {cbosgd, hplabs!hp-sdd, sdcsvax, nosc}!crash!pnet01!haitex
>   ARPA: crash!pnet01!haitex@nosc.mil
>   INET: haitex@pnet01.CTS.COM
Wade, I'm possibly enlightened, but certainly NOT a theory expert, but I have
dabbled just (barely) enough in music theory to be able to give what I think
is a correct explanation.

As you, uh, er, noted, so to speak, Western music is based upon a 12-tone
system.  Specifically, each "octave" is divided into twelve notes.  An
octave is defined as a range of pitches or frequencies such that the high end
is twice the frequency of the low end.  Now, most things about human sensory
response have the property that it is per cent change, or relative change,
that determines the perceived effect.  I.e., things that appear to differ by
the same amount usually turn out to have the same ratio, not the same
arithmetic difference.  (Mathematicians call this a "logarithmic" response
because taking a logarithm is what turns equal ratio steps into equal
difference steps.)  Anyway, pitch perception follows this rule very well.
Most listeners immediately recognize that two pitches one octave apart,
i.e. having a 2:1 frequency ratio, are very similar in some audibly obvious
way, though not quite identical.  Carrying the "equal ratio" idea further,
one can subdivide an octave into steps having equal ratios, and that is
precisely what the "tempered diatonic scale" does.  If you want a ratio such
that multiplying something by this ratio, R, twelve times in succession
gets you to precisely TWICE the original frequency, then, voila, you need to
solve the equation

	    12
	F1xR   =  F2.
			 12                 1/12
where F2 = 2 F1.  Then  R   =  2, so  R = 2     , i.e. R must be the twelfth
root of 2.

That's what the tempered diatonic scale does, it constructs a scale of 12
notes so that each is the twelfth root of two times the previous one.
At this point, my knowledge starts to run out.  Apparently this gives pitches
that are acceptably accurate for most purposes as approximations to the
true pitches in every key, partly because the 12th root of 2 is a fairly small
ratio to begin with (about 1.059).  (Obviously the 60th root of 2 would give
an even better universal scale!)  I conjecture that the "ideal" notes
are subharmonics of higher octaves or something, i.e F1 time 4/3, 8/5, etc.
and in general a power of 2 (higher octave) divided by a small odd integer
which gives a result between 1 and 2 (to put it in the reference octave of
interest).  (I just thought that up fast, in an attempt to sound as though I
know what I am talking about, but re-reading it after thinking through what
follows, I suspect it is correct.)
.pg
The question is just how closely the ratio R lets us approximate these
pitches.  For example, 4/3 is 1.3333333... and 8/5 is 1.60000 whereas the
steps we get from the twelfth root of 2 are 1.122462, 1.1892071, 1.259921,
1.3348399, 1.4142136, 1.4983071, 1.5874011, 1.6817928, 1.7817974, 1.8877486,
and 2.0000000.  We can see that 4/3 is very closely approximated, with an
error of only 0.113%, 8/5 is only off by 0.79%, etc.  I.e. if you tune your
guitar for the "tempered" ratios, you should find that it sounds equally good
(or bad) in all keys, but if you tune by ear, you will go for 1.3333333 and
1.600000 etc., and it will sound even better in the key you tuned for, but
horrible when you move your reference point F1 somewhere else so that the
1.333333 and 1.600000 no longer fall in the right places.
.pg
I have fooled around with writing BASIC programs to make music, and the
tempered scale makes it pretty easy - you just compute 2^(1/12) once,
then fill up an array covering as many octaves as you like with pitches.
From there it's just a matter of picking the pitches out of the array
in some clever fashion.  If you want to make chords, you need to make up
some rules for skipping over dissonant pitches and picking out ones that
will sound good together.  The numbers above give the clue -- ones that
are close to numbers of the form 2^N / M where M is odd (else you could
reduce N a bit) and the fraction is between 1 and 2 tend to sound harmonious,
thus the 1.33333 and 1.60000.  Since I have heard of "thirds" and "fifths",
and "sevenths" for that matter, I now conjecture that these are just magic
ratios of the above noted form where M is 3, 5, 7, etc.  Golly, I think we
are ALL expert music theorists now!

I did a BASIC program on the Atari 800XL, which has a 4-voice sound generator
(and by the way costs only about $70!) and got some very pleasant sounding
"alleatoric" music with 4-part chords, using random numbers to make some
whimsical choices of notes from the array.  I found the best results came
from a "random walk" for one main theme note, then some random choices of
thirds, fifths, etc. from the array.  After going through the above reasoning,
I think a better way would be to just compute the 4/3, 8/5, etc on the spot,
because it would probably sound more harmonious.  Oh, by the way, you also
need some correction logic to make the random walk head back toward the
mid-range if it runs up against some extreme high or low pitch.

The 800XL BASIC program is available if anyone wants me to post it.  I imagine
you could port it, maybe less one voice, to the ST fairly easily.

Note that when producing pitches on your computer, you will have another
source of error, which is the quantization of pitch that the computer imposes.

I hope this (a) answers your question, (b) is true, and (c) is of enough
general interest that the barrage of bytes is not resented too much by the
innocent bystanders.

-John