DSPRelated.com
Forums

AGC before FFT in piano frequency analysis

Started by Robert Scott March 3, 2004
"Ronald H. Nicholson Jr." <rhn@mauve.rahul.net> wrote in message
news:c2q73k$3p1$3@blue.rahul.net...
> In article <c2jsi4$113$04$1@news.t-online.com>, > Wolfgang <never@nowhere.com> wrote: > >Despite the fact that AGC changes freq. content a little bit I want to > >point out that mostly the "tone" of an instrument is not constant over > >playing it. > >Some years ago I wanted to write a note recognition system for a guitar > >and I found out that the harmonic content is dramatically changing over > >time. Nevertheless you don't look at harmonics also your content of
interest
> >may change over time. > > I've also done some analysis of guitar sound and found that not only does > the harmonic content of a plucked string change over time, but that the > fundamental pitch can change between the attack and decay portions of > the waveform, especially true of the lowest notes on a bass guitar with > their larger strings.
I've noticed this too. Even on the low strings of an acoustic guitar, my tuner needle moves slightly (upward IIRC) as the note decays. And it seems the higher harmonics die out quicker than the lower ones, causing the signal to become "more sinusoidal" as it decays.
> Makes it an interesting question to decide when an instrument is > "in tune"... > > I wonder is the low notes of some pianos may have the same behavior? > Or is it an effect caused by "pluck" versus "hammer".
I'm guessing it's the deformation caused by a hard pluck, but I don't know.
Ronald H. Nicholson Jr. wrote:

   ...

> * a "cent" being defined as the ratio pow(2.0, (1.0/1200.0))
In other words, 1/100th of a semitone. How many people even hear that the bottom octave of a piano is maybe a half tone flat of the top. One cent amounts to 1 Hz in 1731. I know I can't hear it. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
In article <4050d46f$0$2791$61fed72c@news.rcn.com>,
Jerry Avins  <jya@ieee.org> wrote:
>In other words, 1/100th of a semitone. How many people even hear that >the bottom octave of a piano is maybe a half tone flat of the top. One
Although we probably can't hear a 1 Hz difference in a note (near an A, two octaves above middle-C) when played separately in time from any other tone reference, most people can easily hear the "beats" given as little as a 2 Hz difference between a note and a strong harmonic of a note an octave or 3 lower. I've been told that professional musicians and piano tuners can hear the beats due to fractions of a Hz differences. I'm not sure why people care, given that almost every instrument is way out of tune these days since they are usually tuned in the equal temperament intonation. It took several centuries for people to become accustomed to equal temperament intonation, which is in places 14 cents out of tune with itself. It's an engineering compromize to make all pre-tuned instruments equally out of tune on the same chords in every key. The book "Temperament", by Stuart Isacoff, is light on technical detail, but presents an interesting history on the subject. IMHO. YMMV. -- Ron Nicholson rhn AT nicholson DOT com http://www.nicholson.com/rhn/ #include <canonical.disclaimer> // only my own opinions, etc.
rhn@mauve.rahul.net (Ronald H. Nicholson Jr.) wrote in message news:<c2qcc9$5b7$1@blue.rahul.net>...
> In article <BC7361EB.940E%rbj@surfglobal.net>, > robert bristow-johnson <rbj@surfglobal.net> wrote: > >you got some of this down right. you might want to go to the > >harmony-central.com site and check this out: > > > >> http://www.harmony-central.com/Synth/Articles/Wavetable_101/Wavetable-101.pdf > > > >if you can make a pretty good pitch detector (that is really a period > >estimator), you can measure the change of phase of each harmonic and use > >that to compute how much each one is detuned from the exact harmonic value. > > How accurate is "pretty good"?
the kind of pitch detector i have worked on uses some kinda interpolation to determine the period of a periodic signal to a fraction of a sample. even a crappy pitch detector can do that, but it has other problems (how to deal with transients, and the ubiquitous "octave problem"). the difference between a "pretty good" pitch-detector and an gadawful one is not the precision of measure but the confidence of the measure.
> The specsmanship in the electronic guitar tuner business is usually in > the range of 1 to 5 cents accuracy (corresponding to about +-0.2 to 1 Hz > at 330 Hz). In the professional electronic piano tuner business, I've > been told they spec frequency standards to 0.1 cents accuracy > (+-0.02 Hz at 330 Hz). > > I have no idea if 0.1 cent of frequency difference is audible > to humans.
no. not at all. if side-to-side listening is not used (where beating might be heard) people don't discriminate much better than 6 cents or 0.35% frequency difference.
> It's certainly near the limit of the cheap non-temperature > compensated crystal oscillators used on most PC's and DSP boards.
assuming that the sampling frequency is solid, a pitch detector can certainly output a number to 0.01 cent precision or better and it might work *real* good on a rock solid sine wave. again, that is not the acid test for them. there is a simple concept of a pitch detector based loosely on the AMDF (or more accurately ASDF) function in that wavetable-101.pdf paper. the idea is that, even if the measured f0 is off by a Hz or two, that will be noticed by the change of phase in every harmonic because you would be extracting a wavetable every millisecond. you could tell if something was off by 200 or 300 Hz with that "secondary" sample rate. r b-j
In article <4cbb922e.0403112257.3a444f22@posting.google.com>,
robert bristow-johnson <rbj@surfglobal.net> wrote:
>> It's certainly near the limit of the cheap non-temperature >> compensated crystal oscillators used on most PC's and DSP boards. > >assuming that the sampling frequency is solid, a pitch detector can >certainly output a number to 0.01 cent precision or better and it >might work *real* good on a rock solid sine wave.
Unless I lost a decimal place, that 0.01 cent digit might be as much a measurement of the current temperature of the crystal oscillator used for your A/D sample rate generator as of frequency of the input signal. IMHO. YMMV. -- Ron Nicholson rhn AT nicholson DOT com http://www.nicholson.com/rhn/ #include <canonical.disclaimer> // only my own opinions, etc.
On Thu, 11 Mar 2004 11:05:17 -0800, "Jon Harris" <goldentully@hotmail.com>
wrote:

>"Ronald H. Nicholson Jr." <rhn@mauve.rahul.net> wrote in message >news:c2q73k$3p1$3@blue.rahul.net... >> In article <c2jsi4$113$04$1@news.t-online.com>, >> Wolfgang <never@nowhere.com> wrote: >> >Despite the fact that AGC changes freq. content a little bit I want to >> >point out that mostly the "tone" of an instrument is not constant over >> >playing it. >> >Some years ago I wanted to write a note recognition system for a guitar >> >and I found out that the harmonic content is dramatically changing over >> >time. Nevertheless you don't look at harmonics also your content of >interest >> >may change over time. >> >> I've also done some analysis of guitar sound and found that not only does >> the harmonic content of a plucked string change over time, but that the >> fundamental pitch can change between the attack and decay portions of >> the waveform, especially true of the lowest notes on a bass guitar with >> their larger strings. > >I've noticed this too. Even on the low strings of an acoustic guitar, my >tuner needle moves slightly (upward IIRC) as the note decays.
This effect is opposite to the effect of higher average tension when the string is vibrating more. So maybe whatever causes this effect will nicely cancel out the effect of the higher tension in some cases? Tony (remove the "_" to reply by email)
On Thu, 11 Mar 2004 18:49:45 +0000 (UTC), rhn@mauve.rahul.net (Ronald H.
Nicholson Jr.) wrote:

>In article <BC7361EB.940E%rbj@surfglobal.net>, >robert bristow-johnson <rbj@surfglobal.net> wrote: >>you got some of this down right. you might want to go to the >>harmony-central.com site and check this out: >> >>> http://www.harmony-central.com/Synth/Articles/Wavetable_101/Wavetable-101.pdf >> >>if you can make a pretty good pitch detector (that is really a period >>estimator), you can measure the change of phase of each harmonic and use >>that to compute how much each one is detuned from the exact harmonic value. > >How accurate is "pretty good"? > >The specsmanship in the electronic guitar tuner business is usually in >the range of 1 to 5 cents accuracy (corresponding to about +-0.2 to 1 Hz >at 330 Hz). In the professional electronic piano tuner business, I've >been told they spec frequency standards to 0.1 cents accuracy >(+-0.02 Hz at 330 Hz).
I imagine it would be quite hard to achieve this accuracy - to detect the difference between a beat that cycles once every 50 seconds and the natural decay of the string. Tony (remove the "_" to reply by email)
robert bristow-johnson wrote:

> but how about a 3 Hz component to the envelope of the 211.5 Hz component? > (assuming that the amplitude of the 210 and 213 are about the same. if they > are not, then it's different, but there would still be, from the POV of a 15 > ms window, a single component somewhere between 210 and 213, and it would > have a slowly varying amplitude.)
Do you mean 211.5Hz amplitude modulated with carrier surpressed? Then it really is 210Hz and 213Hz, with no 211.5Hz or 3Hz. You will still hear the 3Hz beat, though. -- glen