DSPRelated.com
Forums

Analyzing Cross Spectrum for Pitch.

Started by MatthewA May 17, 2016
On Sat, 21 May 2016 08:03:20 -0500, "Cedron" <103185@DSPRelated>
wrote:

>> >>I think one thing that is very telling is that the majority of people >>here post under their real names. You don't. >> >>That actually says quite a bit. > >If you can't attack the message, attack the messenger. This is known as >an "ad hominem" fallacy, generally considered to be in poor form which >says a bit about you, no? > >I have my reasons, and they are none of your business. I think your >intended aspersions are baseless. I am not dishonest about it either, if >you check my blogger profile you will see it starts with "Cedron Dawg is >the pen name..."
There are certainly valid reasons to use a pen name. And there are also very disingenuous reasons to do so. Since a few of us do know your real name and have had outside experience with you, it really does raise legitimate questions.
>If you want to fault what I have said you can point out that I never >backed up my claim that a parabolic fit was an approximation, not a true >equation. My response would be, especially to a theory adverse crowd, >that a numerical example should be sufficient and you can do that >yourself.
Oh, there are plenty of ways to fault things you've said. And I would think that a majority of the crowd in this group is well aware that a parabolic is an approximation to the main lobe of a sinx/x? Why would it be anything but?
>To put things in perspective, Les Cargill pointed out that one percent was >adequate for a guitar string. An 'A' tone at 440Hz in a CD quality >44,100Hz recording is roughly 100 samples per wavelength. A one sample >error on a one wavelength samping will then be about one percent.
>In comparison, every semitone on the standard chromatic music scale is >about a 6% increase in frequency. ( 2^(1/12) = 1.059463094 ) I've met >musicians who can tune their instruments by ear that can easily discern >less than a 1% change in pitch.
No, a cent. That's very different than one percent.
>The percentage frequency change between bins in a DFT depend on the bin >number and can be simply calculated using the ratio of the bin numbers. > >Ced >--------------------------------------- >Posted through http://www.DSPRelated.com
eric.jacobsen@ieee.org (Eric Jacobsen) writes:
> [...] > No, a cent. That's very different than one percent.
Why was the guitar tuner algorithm not closer to the Cramer-Rao bound? Because it just didn't make any cents... -- Randy Yates, DSP/Embedded Firmware Developer Digital Signal Labs http://www.digitalsignallabs.com
On Sat, 21 May 2016 11:52:30 -0400, Randy Yates
<yates@digitalsignallabs.com> wrote:

>eric.jacobsen@ieee.org (Eric Jacobsen) writes: >> [...] >> No, a cent. That's very different than one percent. > >Why was the guitar tuner algorithm not closer to the Cramer-Rao bound? >Because it just didn't make any cents...
That works on so many levels... ;)
>-- >Randy Yates, DSP/Embedded Firmware Developer >Digital Signal Labs >http://www.digitalsignallabs.com
Cedron wrote:
>> >> I think one thing that is very telling is that the majority of people >> here post under their real names. You don't.
<snip>
> > To put things in perspective, Les Cargill pointed out that one percent was > adequate for a guitar string. An 'A' tone at 440Hz in a CD quality > 44,100Hz recording is roughly 100 samples per wavelength. A one sample > error on a one wavelength samping will then be about one percent. >
That's one *cent*, not one *percent*. A "cent" is 1/100 of a semitone. One cent sharp is 1.000578 in pitch ratio or 0.0578 percent. One percent is 17.227 cents. http://www.sengpielaudio.com/calculator-centsratio.htm A guitar string may have uncertainty of a cent or two before you even start measuring it. In my experience, even experienced listeners may miss pitch being off by 2 cents.
> > Ced > --------------------------------------- > Posted through http://www.DSPRelated.com >
-- Les Cargill
Randy Yates wrote:
> eric.jacobsen@ieee.org (Eric Jacobsen) writes: >> [...] >> No, a cent. That's very different than one percent. > > Why was the guitar tuner algorithm not closer to the Cramer-Rao bound? > Because it just didn't make any cents... >
Nice! -- Les Cargill
> >That's one *cent*, not one *percent*. A "cent" is 1/100 of a semitone. > >One cent sharp is 1.000578 in pitch ratio or 0.0578 percent. > >One percent is 17.227 cents. > >http://www.sengpielaudio.com/calculator-centsratio.htm >
I'm sorry I misquoted you. It was an honest mistake, I had no intention of being misleading. Thanks to you and the others for the correction. Here is the math behind those numbers for those who are interested: 2^(1/1200) = 1.00057779 ( 2^(1/1200) ) ^ x = 1.01 x * log( 2^(1/1200) ) = log( 1.01 ) x * (1/1200) * log( 2 ) = log( 1.01 ) x = 1200 * log( 1.01 ) / log( 2 ) x = 17.226351572
>A guitar string may have uncertainty of a cent or two before >you even start measuring it. In my experience, even experienced >listeners may miss pitch being off by 2 cents. > > >-- >Les Cargill
That sounds a lot more reasonable. Ced --------------------------------------- Posted through http://www.DSPRelated.com
>Oh, there are plenty of ways to fault things you've said. And I >would think that a majority of the crowd in this group is well aware >that a parabolic is an approximation to the main lobe of a sinx/x? >Why would it be anything but? >
If I say something factually wrong, I really do appreciate having it pointed out. If you don't like my presentation style or terminology, feel free to mention it, but don't expect me to necessarily agree. I assume your reference to the unnormalized sinc function (sin(x)/x) is supposed to pertain to my response to Evgeny Filatov's assertion that a polynomial interpolation will give a true frequency. It does not pertain. Once again, you are conflating the continuous case with the discrete case. The sinc function does not accurately describe the leakage magnitudes or the theoretical DFT values "between the bins" in the discrete case. If it did, side lobe magnitudes (leakage) in cases with an integer plus a half frequency would be symmetric about the peak. This is not how it works. Here is a concrete numerical example to demonstrate that: N = 16 S_n = cos( 5.5 * n * 2Pi/N + 1.0 ) Bin Real Imag Mag Abs(Sinc) x --- ------- -------- ------- ------- ------ 0 0.00566 0.00000 0.00566 0.05787 -5.500 1 0.00421 0.00873 0.00970 0.07074 -4.500 2 -0.00086 0.01891 0.01893 0.09095 -3.500 3 -0.01284 0.03325 0.03564 0.12732 -2.500 4 -0.04494 0.06078 0.07559 0.21221 -1.500 5 -0.21916 0.18046 0.28390 0.63662 -0.500 6 0.32234 -0.15757 0.35879 0.63662 0.500 7 0.15250 -0.03509 0.15648 0.21221 1.500 8 0.13216 -0.00000 0.13216 0.12732 2.500 9 0.15250 0.03509 0.15648 0.09095 3.500 10 0.32234 0.15757 0.35879 0.07074 4.500 11 -0.21916 -0.18046 0.28390 0.05787 5.500 12 -0.04494 -0.06078 0.07559 0.04897 6.500 13 -0.01284 -0.03325 0.03564 0.04244 7.500 14 -0.00086 -0.01891 0.01893 0.03745 8.500 15 0.00421 -0.00873 0.00970 0.03351 9.500 In this example, I used the normalized sinc function (sin(x*Pi)/(x*Pi)). Here is a neat web page that covers the topic: https://jackschaedler.github.io/circles-sines-signals/dft_leakage.html There is indeed a true equation that describes the side lobe values (and therefore magnitudes) of a pure tone with non-integer frequency in a DFT. It is not the sinc function. It can be found, in various forms, along with its derivation in my blog article titled "DFT Bin Value Formulas for Pure Real Tones". Here is the URL: https://www.dsprelated.com/showarticle/771.php Ced --------------------------------------- Posted through http://www.DSPRelated.com
> >In this example, I used the normalized sinc function (sin(x*Pi)/(x*Pi)). >
Okay, I made a small mistake again. I should have multiplied the Abs(Sinc) column by 0.5. This will make the values a better fit, but has no impact on the point I am making. Ced --------------------------------------- Posted through http://www.DSPRelated.com
Cedron wrote:
>> >> That's one *cent*, not one *percent*. A "cent" is 1/100 of a semitone. >> >> One cent sharp is 1.000578 in pitch ratio or 0.0578 percent. >> >> One percent is 17.227 cents. >> >> http://www.sengpielaudio.com/calculator-centsratio.htm >> > > I'm sorry I misquoted you. It was an honest mistake,
It's completely understandable. I misread stuff all the time.
> I had no intention > of being misleading. Thanks to you and the others for the correction. > > Here is the math behind those numbers for those who are interested: > > 2^(1/1200) = 1.00057779 > > > ( 2^(1/1200) ) ^ x = 1.01 > > x * log( 2^(1/1200) ) = log( 1.01 ) > > x * (1/1200) * log( 2 ) = log( 1.01 ) > > x = 1200 * log( 1.01 ) / log( 2 ) > > x = 17.226351572 > >> A guitar string may have uncertainty of a cent or two before >> you even start measuring it. In my experience, even experienced >> listeners may miss pitch being off by 2 cents. >> >> >> -- >> Les Cargill > > That sounds a lot more reasonable. >
Well, there ya go :)
> Ced > --------------------------------------- > Posted through http://www.DSPRelated.com >
-- Les Cargill
On Sat, 21 May 2016 19:05:21 -0500, "Cedron" <103185@DSPRelated>
wrote:

>>Oh, there are plenty of ways to fault things you've said. And I >>would think that a majority of the crowd in this group is well aware >>that a parabolic is an approximation to the main lobe of a sinx/x? >>Why would it be anything but? >> > >If I say something factually wrong, I really do appreciate having it >pointed out. If you don't like my presentation style or terminology, feel >free to mention it, but don't expect me to necessarily agree. > >I assume your reference to the unnormalized sinc function (sin(x)/x) is >supposed to pertain to my response to Evgeny Filatov's assertion that a >polynomial interpolation will give a true frequency.
That's an incorrect assumption.
>It does not pertain. Once again, you are conflating the continuous case >with the discrete case. The sinc function does not accurately describe >the leakage magnitudes or the theoretical DFT values "between the bins" in >the discrete case. If it did, side lobe magnitudes (leakage) in cases >with an integer plus a half frequency would be symmetric about the peak. >This is not how it works.
Funny.
>Here is a concrete numerical example to demonstrate that: > >N = 16 > >S_n = cos( 5.5 * n * 2Pi/N + 1.0 ) > >Bin Real Imag Mag Abs(Sinc) x >--- ------- -------- ------- ------- ------ > 0 0.00566 0.00000 0.00566 0.05787 -5.500 > 1 0.00421 0.00873 0.00970 0.07074 -4.500 > 2 -0.00086 0.01891 0.01893 0.09095 -3.500 > 3 -0.01284 0.03325 0.03564 0.12732 -2.500 > 4 -0.04494 0.06078 0.07559 0.21221 -1.500 > 5 -0.21916 0.18046 0.28390 0.63662 -0.500 > 6 0.32234 -0.15757 0.35879 0.63662 0.500 > 7 0.15250 -0.03509 0.15648 0.21221 1.500 > 8 0.13216 -0.00000 0.13216 0.12732 2.500 > 9 0.15250 0.03509 0.15648 0.09095 3.500 >10 0.32234 0.15757 0.35879 0.07074 4.500 >11 -0.21916 -0.18046 0.28390 0.05787 5.500 >12 -0.04494 -0.06078 0.07559 0.04897 6.500 >13 -0.01284 -0.03325 0.03564 0.04244 7.500 >14 -0.00086 -0.01891 0.01893 0.03745 8.500 >15 0.00421 -0.00873 0.00970 0.03351 9.500 > >In this example, I used the normalized sinc function (sin(x*Pi)/(x*Pi)).
Attempting to make a point about the inadequacy of the (correct) sinx/x model by comparing the DFT output for a real-valued tone with the expected output for a complex-valued is not competent.
>Here is a neat web page that covers the topic: > >https://jackschaedler.github.io/circles-sines-signals/dft_leakage.html
Looks good to me after a quick scan. The interactive plots are cool. I'm not sure why you cite it after disagreeing with it above.
>There is indeed a true equation that describes the side lobe values (and >therefore magnitudes) of a pure tone with non-integer frequency in a DFT. >It is not the sinc function. It can be found, in various forms, along >with its derivation in my blog article titled "DFT Bin Value Formulas for >Pure Real Tones". > >Here is the URL: > >https://www.dsprelated.com/showarticle/771.php > >Ced >--------------------------------------- >Posted through http://www.DSPRelated.com