Maker Pro
Maker Pro

Best way to measure precise harmonics?

J

John Larkin

Bad news. Piano harmonics are not exact integer multiples. See:
<http://en.wikipedia.org/wiki/Harmonic_series_(music)>
especially the section on "harmonics and tuning". If it were exact
integers, it would be easy.
<http://en.wikipedia.org/wiki/Piano_tuning>


Sorry, I didn't get that the signal came off a piano string.

Even bells have non-trivial harmonic relationships, and nearby modes.
I'd guess that a bell is more linear than a piano string.

In college, I attempted to tune an upright piano using an ancient HP
nixie tube counter to its limits of accuracy using exact harmonic
overtone series frequencies. It sounded "dead" and generally lousy. I
was later rescued by a professional piano tuner who explained how it
works. I've tuned 4 pianos since then, with varying degrees of effort
and success.

What he's apparently (not sure) trying to do is mimick the art of the
piano or string instrument tuner. That's going to be rough because
the very best piano tuners adjust their tuning for the type of music
to be played, the acoustics of the concert hall, and the expected
length of time between tuning and the actual concert. Basic guides,
such as:
<http://piano.detwiler.us/index.html>
are a great start. However, using a modified guitar tuner directly is
not going to result in the correct harmonic partials. Note the above
instructions say to ignore the piano tuner and rely on the beat notes.

My best guess(tm) is that it's going to take filters (to remove the
fundamental) and a period counter to do this.

I don't think a single scaler "frequency" will be too meaningful,
although it might do for tuning, once you normalize that number to
something that sounds right.

My bell-tuning friend soon discovered that tweaking them wasn't a
simple mathematical procedure.

John
 
C

colin

eromlignod said:
...... I can measure
the period in the time of one vibration of the string (<40ms) and it
is much more accurate.

as you also suggest filtering and period measurement,
I would suggest doing the filtering digitally,
its just as easy to then do the period measurement while it is still
digitised.

a pc soundcard would probably be sufficient for this.

Colin =^.^=
 
R

Rich Grise

Hi guys:

I need to find the component harmonic frequencies of an AF wave and I
need for it to be pretty precise (+/- .001 Hz or so). I have access
to a spectrum analyzer, but it just doesn't seem to be precise enough
(or I'm using it wrong). It gives me peaks in a frequency domain, but
they are not pinpoint lines, ostensibly due to a limited-sample FFT.

Are there any other devices or methods to obtain accurate frequencies
of each harmonic to three decimal places? Thanks for any suggestions
you might have.

Don

Is this for that self-tuning piano someone was talking about a year
or so ago? Was that you?

Thanks,
Rich
 
J

Jon Slaughter

eromlignod said:
Hi guys:

I need to find the component harmonic frequencies of an AF wave and I
need for it to be pretty precise (+/- .001 Hz or so). I have access
to a spectrum analyzer, but it just doesn't seem to be precise enough
(or I'm using it wrong). It gives me peaks in a frequency domain, but
they are not pinpoint lines, ostensibly due to a limited-sample FFT.

Are there any other devices or methods to obtain accurate frequencies
of each harmonic to three decimal places? Thanks for any suggestions
you might have.

You will not be able to get that resolution. There are to many factors
involves. When a string vibrates it does so with at a range of frequencies.
(They are not integer multiples of the fundamental and higher harmonics
differ drastically.)

Your 0.001Hz in the upper range, say, C4 = 261hz, gives you an error of
0.002/261 = 7.6*10^(-6) but in the upper partials, say C8 = 4186, has error
that is 1/4000th of that. (so your error actually decreases drastically as
you increase frequency, but that surely doesn't make sense)

Think about it this way, the average musician can usually hear a frequency
difference of 5 cents. This corresponds to a range C4 +- 0.751 hz but at C8
this is about +- 13hz.

As you probably already know, humans ear "logarithmically". Your error needs
to take that into account or it actually ends up being much more precise in
the higher frequencies than the lows.

Of course you could have something, that say, gives you your 0.001hz at C1
but then your 100x more than what is needed for 5 cent approximation(surely
you'll want more but how much?). but at C8 your 13000x better.

So if you can get 0.001hz it does you no good in the higher frequencies and
its just a huge waste.

Either settle for less accuracy in the lower range or develope a better
technique that works seperately for the two different domains.

This is not to say you can't do it quite easily. You should realize that
sounds produced by any instrument is not mathematical and cannot be
described exactly by mathematics. Your going to have to settle for some
approximation.

Increase your sampling size or average over periods and take the most
probable frequency(the highest point). That is probably the best your going
to do. I don't think you'll ever get 0.001hz because no string vibrates
within that range.... even if it could no one could tell the difference
between two tunings there were 0.008 hz apart(unless the fundamental was
like 0.1hz).

So essentially your anaysis is unrealistic and doesn't reflect reality. Not
only that, even the device measuring the frequency will introduce its own
distortions. You need to ask yourself what your really trying to do here.
 
R

Rich Grise

If you've got a steady-state oscillation, a simple frequency counter
should do just fine. Even a cheap crystal timebase will be stable to a
ppm per month, often a ppm per year.

I wonder what the tempco of a steel string will be. That's probably
the dominant thing that walks the frequency around. 10, 20 PPM/K?

It must be quite significant - many years ago, I was able to afford
a spinet piano, and they were very emphatic about placing it against
an interior wall, nowhere near a heat register, and so on.

The tuner guy was surprisingly reasonable - this was in the 1970's
or 1980's, and the tuning was about 35 bucks.

I couldn't call him again later; his name was Oppornockity. ;-)
</joke>

Cheers!
Rich
 
R

Rich Grise

I already know all of this. I'm not tuning a piano, I'm analyzing the
individual harmonics of a string.

Those are overtones, which are not exact harmonics for a string.

Cheers!
Rich
 
R

Rich Grise

Measure the fundamental. And good luck with that. With piano (or other
stringed instrument) the decay of the harmonics and possibly some phase
shifts over time will introduce errors at the .001 Hz level.

The low midrange are two strings in parallel, and the mid to top
range are three strings in parallel (physically, of course) they're
deliberately detuned from each other to give a "richer, fuller" tone,
if you'll forgive the 'phool terminology.

A piano tuned with the strings exactly dead-nuts would sound awful.

Thanks,
Rich
 
E

eromlignod

You will not be able to get that resolution. There are to many factors
involves. When a string vibrates it does so with at a range of frequencies.
(They are not integer multiples of the fundamental and higher harmonics
differ drastically.)

Your 0.001Hz in the upper range, say, C4 = 261hz, gives you an error of
0.002/261 = 7.6*10^(-6) but in the upper partials, say C8 = 4186, has error
that is 1/4000th of that. (so your error actually decreases drastically as
you increase frequency, but that surely doesn't make sense)

Think about it this way, the average musician can usually hear a frequency
difference of 5 cents. This corresponds to a range C4 +- 0.751 hz but at C8
this is about +- 13hz.

As you probably already know, humans ear "logarithmically". Your error needs
to take that into account or it actually ends up being much more precise in
the higher frequencies than the lows.

Of course you could have something, that say, gives you your 0.001hz at C1
but then your 100x more than what is needed for 5 cent approximation(surely
you'll want more but how much?). but at C8 your 13000x better.

So if you can get 0.001hz it does you no good in the higher frequencies and
its just a huge waste.

Either settle for less accuracy in the lower range or develope a better
technique that works seperately for the two different domains.

This is not to say you can't do it quite easily. You should realize that
sounds produced by any instrument is not mathematical and cannot be
described exactly by mathematics. Your going to have to settle for some
approximation.

Increase your sampling size or average over periods and take the most
probable frequency(the highest point). That is probably the best your going
to do. I don't think you'll ever get 0.001hz because no string vibrates
within that range.... even if it could no one could tell the difference
between two tunings there were 0.008 hz apart(unless the fundamental was
like 0.1hz).

So essentially your anaysis is unrealistic and doesn't reflect reality. Not
only that, even the device measuring the frequency will introduce its own
distortions. You need to ask yourself what your really trying to do here.


Please read the rest of my postings in this thread. I know what I'm
doing.

Don
 
E

eromlignod

Is this for that self-tuning piano someone was talking about a year
or so ago? Was that you?

Thanks,
Rich


Yeah, that's me, but no, this is a different project. You can read
about the self-tuner here if you're interested:

http://query.nytimes.com/gst/fullpage.html?res=9800E1D8133FF931A35752C0A9659C8B63

http://www.newscientist.com/article/dn3143.html

http://www.npr.org/templates/story/story.php?storyId=878091

I can obtain very precise single readings of the fundamental all day
long. That's a done-deal for me. Now I'd like to be able to compare
relative harmonics (yes, I know they're "overtones", but the two terms
are usually used interchageably in music). I can't tell you a whole
lot about what I'm up to, since this patent hasn't issued yet, but
thanks for the help.

Don A. Gilmore
Kansas City
 
J

Jon Slaughter

eromlignod said:
Please read the rest of my postings in this thread. I know what I'm
doing.

If you knew what you were doing you wouldn't have asked such a thing...
Anyways, your going to do what your going to do so do it.
 
E

eromlignod

If you knew what you were doing you wouldn't have asked such a thing...
Anyways, your going to do what your going to do so do it.- Hide quoted text -


I'm sorry Jon; I didn't mean to come across like a smartass.

I currently have methods to determine pitch with very high accuracy
and I'm well aware of the musical ramifications of my work. I was
just hoping that there was a product out there with similar accuracy,
but that would allow me to compare each harmonic frequency, not just
measure the fundamental alone.

As has been suggested, it looks like I'll have to use my device in
conjunction with a tuneable band-pass filter and measure each harmonic
one at a time.

Don
 
M

mike

Rich Grise said:
It must be quite significant - many years ago, I was able to afford
a spinet piano, and they were very emphatic about placing it against
an interior wall, nowhere near a heat register, and so on.

The tuner guy was surprisingly reasonable - this was in the 1970's
or 1980's, and the tuning was about 35 bucks.

I couldn't call him again later; his name was Oppornockity. ;-)
</joke>

Cheers!
Rich
Rich, I heard that joke 42 years ago in fifth grade.
Hmm, I wonder if that teacher was as good looking as I remember her?
Mike
 
T

Tom Bruhns

Please read all of my posts in this thread. I have infinite sustain
time and I don't need to use a frequency counter to determine
frequency. The frequencies are much too low for that. I can measure
the period in the time of one vibration of the string (<40ms) and it
is much more accurate.

Don

You said you wanted to find the frequencies of the harmonics in a
waveform. FFT-based spectral analysis will work fine for that. Use a
spectrum over a frequency range appropriate to capture the essence of
the harmonics you want to look at more carefully, and then zoom in on
each one as appropriate: set the center frequency to the nominal
harmonic frequency, and set the span low enough to capture what you
want. Used properly, it will give you much more information than the
period of the waveform does. The period, for example, does not tell
you if a harmonic is exactly a multiple of the fundamental, or not.
The FFT can easily do that, at least up to the limits of the dynamic
range of the instrument.

Cheers,
Tom
 
J

Jon Slaughter

eromlignod said:
I'm sorry Jon; I didn't mean to come across like a smartass.

I currently have methods to determine pitch with very high accuracy
and I'm well aware of the musical ramifications of my work. I was
just hoping that there was a product out there with similar accuracy,
but that would allow me to compare each harmonic frequency, not just
measure the fundamental alone.

As has been suggested, it looks like I'll have to use my device in
conjunction with a tuneable band-pass filter and measure each harmonic
one at a time.


Well, I'm not going to read your other posts. Sorry. Maybe you do explain in
more detail whats going on but I have my own projects I have to work on.

I think though what your failing to realize is that the signal your trying
to measure is not stable. That is, the frequency is time dependent. This
means no matter how accurate you measure you will still get a "blur" of
frequencies and also there amplitudes(which I know you are not worried about
in this case).

Think of vibrato but on a much smaller scale. If you are measuring
frequencies changes past this level it does no good.

For example, Lets suppose you have perfect pitch and can determine the
frequency within 1 cent. Now suppose someone is playing a not on a guitar
and using vibrato. Do you think you can determine the frequency within
1cent? No, its impossible! Why? Because there is no frequency. There is an
average frequency which you can use to determine the average pitch but even
that might be wrong because they might not be vibrating around a fixed
pitch.

So the point is not so much your measuring methods but that the vibrations
themselfs are time-dependent.

A simple model might be something like this:


x(t) = cos(f*t)

then we say that the frequency is f. This is a mathematical model
though(note that its fourier transform is dirac(w + f) + dirac(w - f)...
which are only idealized anyways).

What we really have is something like

x(t) = cos(f(t)*t)

Suppose f(t) is a perfect vibrato around some fixed frequency f

then you have

x(t) = cos((f + A*cos(m*t))*t)

where A is the strength and m is the frequency.

Hopefully you can appreciate that x(t)'s frequencies are spread out around
f. Obviously it depends on both m and A.

I think though that you'll find any real string isn't going to behave as
ideally as you think it is. I could be wrong here as I haven't done any
extensive research on it. One way to sorta see whats going on is look at a
STFFT and watch the frequencies change with time. The fundamentals are not
such a big deal because they are so low and you'll barely see them move but
the higher up you go the more drastic the effect becomes.

If you remember my calculations before, we had C4 was 0.761hz while C8 was
13hz. This means that going through 4 octaves gave a factor of 17. That
might not seem like much but when you consider the higher overtones above
10khz it becomes more signficant(assuming you take the human and his
imperfect ear out of the picture).


In any case, it really depends on what your trying to accomplish. I'll leave
it up to you since you know more about what your trying to do. I'm just
trying to get the point across that your not dealing with a mathematical
model and so you have to work within the confines of reality. From my brief
glimpse of other posts it seems your trying to get the frequencie of a
vibrating piano strings. But again, there is no "frequency" because its
always changing. But what you can do is get an average frequency which will
center around an "ideal" frequency and then you can use that ideal one for
whatever calculations you want. Since most errors will be normally
distributed and most imperfections will be symmetric(for the most part) will
also be distributed symmetrically any type of averaging will reduce them. A
simple average won't work because of potential analomous behavior(outliers)
but taking that into account you'll get a pretty good result(most likely).

If I were you, since you seem concerned with getted the most precise result,
I would look into just how much a normal vibrating string deviates from the
ideal. You should first know what your up against because it might be
impossible to do what you want. (I had a similar problem when trying to do
some pitch shifting stuff)
 
R

Rich Grise

Yeah, that's me, but no, this is a different project. You can read
about the self-tuner here if you're interested:

http://query.nytimes.com/gst/fullpage.html?res=9800E1D8133FF931A35752C0A9659C8B63

http://www.newscientist.com/article/dn3143.html

A "fortnight"? Did you actually say that, in a real conversation? ;-P
I like "Don Gilmore, an inventor..." :)

So, when do we get to hear the .wav of one working?

Thanks,
Rich
 
J

Jeff Liebermann

Sorry, I didn't get that the signal came off a piano string.

Sorry. I assumed it was a piano by the description, mostly because
I'm familiar with its operation. From the description, the strings in
question could be anything from an independently suspended piece of
music wire during manufacturing, to any of a number of musical
instruments. I can't tell which.
Even bells have non-trivial harmonic relationships, and nearby modes.
I'd guess that a bell is more linear than a piano string.

Dunno. As I understand it, any differences in velocity along the
wire, at the different frequencies, will cause inharmonicity:
<http://en.wikipedia.org/wiki/Inharmonicity>
Piano wire is a compromise between external hardness (for that bell
like sound) and tensile strength (for the tension required) resulting
in some non-linearity. I won't pretend to be an expert on music wire
metallurgy, but there appears to be some old books on the subject in
reference to affecting inharmonicity.
I don't think a single scaler "frequency" will be too meaningful,
although it might do for tuning, once you normalize that number to
something that sounds right.

Well, more measurements are always a good thing. If there's
sufficient time, a series of measurements can be made, along with a
histogram of the various resonance measurements. That will give a
better average for calculating the exact frequency, while also
offering a clue if there are any imperfections or variations from a
known good reference.
My bell-tuning friend soon discovered that tweaking them wasn't a
simple mathematical procedure.

That's why music is an art instead of a science. I found that my
abilities in piano tuning was seriously lacking. Yet, I have a friend
that's been doing concert piano and does his own tuning for most of
his long life. Not only can he tune a piano by ear, but he can also
supply the exact notes of any music he hears. I'm jealous. Most
people are in between these extremes. Whether an electronic
instrument can be built to do this electronically, I'll leave as an
exercise for those that still have hair to pull out in frustration.

When the basic accuracy is roughly 1 part in 63 million, we're down in
the area where clock oscillator jitter, zero crossing threshold, and
front end (microphone and amplifier) noise figure, become important
issues. I also suspect that the microphone is capable of generating
as many harmonics as it hears, due to it's potential for
non-linearity.

I'm sure glad this isn't my headache.
 
P

Phil Allison

"eromlignod
"Phil Allison"
Yeah, yeah...go **** yourself, asshole.


** Go **** yourself

YOU ASININE POSTURING CUNTHEAD !!

I'm dealing with the vibration of piano strings which go as low as
27.5 Hz. Pianos are routinely tuned to less than one "cent" of
deviation,


** Ridiculous lie - no such pitch precision is even faintly possible.

which, at 27.5 Hz, amounts to about .016 Hz. That's just
to get it in tune for music. I need to be a little finer than that.


** What utter BOLLOCKS !!


Currently I can measure the fundamental of the low note theoretically
to about 1/1000th of a cent.


** Not even faintly possible with a real piano string.

Actually I measure the period of the
wave by counting the vibrations of a 50 MHz oscillator compared to the
vibration of the string.


** Period timing the sound of a string is totally ridiculous.

But I have found that natural fluctuations
in the pitch of the string as it vibrates don't really allow you to
measure much better than a tenth of a cent or so.

** Yawn - more bollocks.

I'm developing a method of string manufacture to control individual
harmonics relative to each other, so I need to be able to accurately
see their relative frequencies (or periods).


** Ever think of trying an analogue scope ???

When a harmonic component is NOT locked in phase with the fundamental ( ie
the normal situation) - it is visible on a scope trace as a " travelling
wave " on the fundamental.

So the composite wave changes shape with time and this is easy to see.

You can tell if the harmonic is high or low by the direction it is
travelling.

I was hoping there might be a common device or method for this.
Otherwise I'll just have to filter and use my present device.


** There is a total LACK of reality in what you are doing.

As in you.



....... Phil
 
T

Tim Wescott

Hi guys:

I need to find the component harmonic frequencies of an AF wave and I
need for it to be pretty precise (+/- .001 Hz or so). I have access
to a spectrum analyzer, but it just doesn't seem to be precise enough
(or I'm using it wrong). It gives me peaks in a frequency domain, but
they are not pinpoint lines, ostensibly due to a limited-sample FFT.

Are there any other devices or methods to obtain accurate frequencies
of each harmonic to three decimal places? Thanks for any suggestions
you might have.

Don

You mention that this is for piano strings, so you really mean overtones.
EE's get it pounded into our heads in school that a harmonic is at an exact
integer multiple of the fundamental frequency.

You're going to have a big time vs. noise vs. accuracy of measurement
problem. Trying to make this work by counting zero crossings or doing FFTs
is probably not going to lead to joy, particularly because the sound will
decay long before you've collected 1000 seconds worth of sample. You're in
a particular bind because you're trying to get (or make) an instrument to
compete head to head against one of the things that the human nervous
system does very well.

Fortunately, if you can control the noise well, you do _not_ have to
measure the thing for 1000 seconds. I'd do this by recording a good long
chunk of sound, then doing a best fit of a simulated signal with
fundamental + overtones. Once I'd found the best fit I'd look at the
frequencies that I used for the overtones, and call it "right".

--
Tim Wescott
Control systems and communications consulting
http://www.wescottdesign.com

Need to learn how to apply control theory in your embedded system?
"Applied Control Theory for Embedded Systems" by Tim Wescott
Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html
 
T

Tim Wescott

Please read all of my posts in this thread. I have infinite sustain
time and I don't need to use a frequency counter to determine
frequency. The frequencies are much too low for that. I can measure
the period in the time of one vibration of the string (<40ms) and it
is much more accurate.

Don

How are you getting infinite sustain time, and how do you keep your
infinite sustain from disturbing the overtones?

BTW, I don't think you _need_ the infinite sustain to do your measurement.

--
Tim Wescott
Control systems and communications consulting
http://www.wescottdesign.com

Need to learn how to apply control theory in your embedded system?
"Applied Control Theory for Embedded Systems" by Tim Wescott
Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html
 
J

John Larkin

Not even wrong.

Piano string overtones are NOT exact multiples of the fundamental, due
to the lateral stiffness of strings.

An "exactly tuned" piano will thus sound awful.

Instead, the piano keyboard is "stretched", going something like 38
cents or so low on the low end and 12 cents or so high on the high end.

Since the enharmonic overtone relation of a string is well known, the
overtone frequencies are strictly locked to the fundamental. And thus
precisely defined.

Constult any standard piano tuning book for details.

I didn't write any of the above stuff that's attributed to me.

That makes me not not even wrong.

John
 
Top