"Self tuning piano" questions

Don A. Gilmore dgilmore@kcmpi.net
Wed, 24 Dec 2003 23:30:05 -0600


----- Original Message ----- 
From: "Robert Scott" <robert.scott@tunelab-world.com>
To: <pianotech@ptg.org>
Sent: Wednesday, December 24, 2003 8:03 PM
Subject: Re: "Self tuning piano" questions


> Don,
>
> When you say "The method I use for pitch measurement is accurate to about
> 1/6000th of a cent at the low end of the piano", was that a misprint?
> That is equal to about one part in 10 million.  Even at A-440, that means
> a difference of one beat in 6.3 hours!  If you can read such a difference
> in under 10 minutes, then you must be able to detect a phase difference at
> A-440 of 9.5 degrees.  But the note won't sound for that long without
> active stimulation.  I have done active probing for resonsances similar to
> what you did for an article in the Journal, "Measuring Inharmonicity Using
> Continuous Excitation", June 1993.  I found that the resonsant peaks, even
> when measured in this manner, are still too broad to define a resonant
> frequency to any better than about .02 cents.  So 1/6000th of a cent is a
> bit beyond belief.
>
> Robert Scott
> Real-Time Specialties

I can indeed get that accuracy and I can do it in a few milliseconds,
believe it or not.  You have made the assumption that frequency counting is
the only solution to determining frequency (as many in the past have).  To
get 1/6000th of a cent takes a fast processor like we intend to use, but I
can (and did) do it with three simple chips from Radio Shack and still get
an accuracy of 1/200th of a cent and do it in 36 ms!

The signal from the pickups is super-clean (virtually no overtones).  I
convert this wave to a square wave using a simple chip called a Schmitt
trigger ($0.16 at Radio Shack).  Then, rather than count waves for a long
time to get a frequency, I determine the "period" (the time for one complete
vibration), which is just the reciprocal of the frequency and is just as
useful.

How do I get it so accurate?  Well, if I'm willing to splurge another $0.86
I can get a little 10 MHz crystal oscillator.  This puts out 10 million
square-wave pulses each second and is ultra-accurate.  Then for another five
bucks (this is getting expensive!) I buy me a programmable counter chip.
The counter chip has several independent counters that can count pulses this
fast.  I use two of them.

The first one is a one-shot counter and I feed it the square wave from the
piano string and tell it to count to "one".  The way the counter works (I
can get into more detail if you like), this produces an output pulse equal
in duration to exactly one vibration of the string.  I feed this signal to
the "gate" of the second counter.  All the gate does is tell the second
timer when to start and stop counting.  So if I feed it my one-vibration
pulse it will turn the counter "on" for one vibration and then back "off".
What is it counting?  The 10 MHz oscillator!  Then I read the number out of
it to see what I got.  What I get is how many times a 10 MHz oscillator
pulses during one vibration of the string.  Do you see where we're going
here?

Let's use A-440 for an example.  An oscillator pulsing 10 million times a
second would pulse

10,000,000 / 440 = 22,727 times

during one period of A-440.  If I wanted a string to vibrate at exactly 440
Hz, I would have to tune it until my counter read 22,727.  And remember, the
time it takes to do this measurement is just one period, or

1 / 440 = 2.3 milliseconds.

Obviously the largest, slowest waves would be from the Big Daddy A0 string
at 27.5 Hz.  Then the counter would read 10,000,000 / 27.5 = 363,636 pulses.

The resolution of the counter is, obviously, one count (it can't count
fractions of a count, only integers).  The frequency at one cent above A0 is

f = 27.5 x 2^(1/1200) = 27.5159 Hz

This results in a count of 10,000,000 / 27.5159 = 363,426.  This differs
from the other count by

363,636 - 363,426 = 210 pulses

That's 210 pulses difference in reading to detune the note by just one cent.
And it took

1 / 27.5 = 36.4 milliseconds

For about $6.00.

Actually I have found that an accuracy of better than a tenth of a cent or
so is futile since the string naturally wavers more than this even when held
at a constant volume.  It's also far better than any but the finest ear
could detect.

Don A. Gilmore
Mechanical Engineer
Kansas City


This PTG archive page provided courtesy of Moy Piano Service, LLC