back to list

Basic tuning math

🔗John A. deLaubenfels <jadl@xxxxxx.xxxx>

8/13/1999 7:42:38 AM

There has been some interest expressed in having tutorial(s) on the
math involved in tuning. So, here we go...

Imagine this scene: you're at a party. A lovely young woman arrives,
and somehow you find yourself in conversation with her, and somehow it
comes around to tuning, and she asks, "But isn't equal temperament the
perfect way to tune? Why would you want to change it?". Are you ready?
Could grab a calculator and dazzle her with math?

Or are you left stammering? Dont'cha HATE it when that happens? Well,
now you can be math literate, because Uncle John has prepared...

BASIC TUNING MATH: converting frequency ratios to cents and back

A conceptual introduction to logarithms

The piano provides the perfect model, as well as an illustration of why
we have to do these transformations. On the one hand there is the row
of strings: with each octave higher, the frequency doubles, from A440 to
880 to 1760 hertz (cycles/second) as we go up to higher A's; 220, 110,
and 55 hertz as we go down to lower A's. On the other hand, the keys
move in linear progression, twelve semitones per octave.

Logs are a mathematical way of relating doubling to linear motion.
Exponents (powers) go the other way, relating linear motion to doubling.

Whenever the whole process gets confusing, think of the piano. But,
even if you're lost or indifferent so far, you can still do

The math

First you need a calculator with logs and exponents. A key might be
labeled "log" or "ln" (for log natural). The other key we want is
something like "X^Y", where Y is probably a superscript to X, indicating
that the key will raise X to the Y power.

Don't have a calculator with those keys? Get down to the store and buy
one! They're cheap. Yes, you did vow most solemnly you'd never own
anything of the sort, but holding out this long is enough to have made
your point. Now buy (or borrow) one.

Let's walk through some basic calculations. You gotta get this to work
before we can go on. Confess your lack of knowledge to someone who
might know, if you're stuck.

Raise 2.0 to the 3.0 power; get 8.0. I wish I could help you with more
specific instructions, but calculators are all different.

Next exercise: divide the log of 1.5 by the log of 2. It'll go one of
two ways:

If your calculator uses natural logs:

log(1.5) = 0.4055
log(2.0) = 0.6931
log(1.5) / log(2.0) = 0.5850

If your calculator uses base 10 logs:

log(1.5) = 0.1761
log(2.0) = 0.3010
log(1.5) / log(2.0) = 0.5850

Note that the final answer comes out the same, so it doesn't matter;
we're actually calculating "log to base 2" by either path. By the way,
0.5850 happens to be the fraction of an octave representing a perfect
fifth (frequency ratio 1.5).

Cents review: a cent is a measure defined to be 1/100 of a 12 tone
equal temperament semitone. So, a cent is 1/1200 of an octave.

Now you're ready!

To convert frequency ratio to cents interval:

Delta_cents = 1200 x log(freq_ratio) / log(2)

OK, walk thru with an example: a major third, a 5/4 ratio, divides out
to 1.25 frequency ratio; take the log of that; take the log of 2 and
divide; you should see 0.3219 (if your calculator displays intermediate
results); multiply by 1200 and get 386.31 cents (compare with 400 cents
for a major third in 12-tET).

To convert cents interval to frequency ratio:

Freq_ratio = 2 ^ (delta_cents / 1200)

That's "two to the power". Again, do an example: a 12-tET minor third,
3 semitones or 300 cents, divided by 1200 gives 0.25 (octaves). Two
(2.0) raised to that power gives 1.1892; compare to 1.2000 for a perfect
6/5 minor third ratio.

You are SO cool. Put a mortar board on your head!

Note that everything we've talked about relates TWO notes. A single
note in space, such as A440, may be a starting point for forming
intervals, but there's little we can do with it by itself.

JdL