DSPRelated.com
Forums

Analyzing Cross Spectrum for Pitch.

Started by MatthewA May 17, 2016
On Sunday, May 22, 2016 at 12:18:25 PM UTC-4, Eric Jacobsen wrote:
> On Sat, 21 May 2016 19:05:21 -0500, "Cedron" <103185@DSPRelated> > wrote: > > > .... 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. >
....
> > > >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.
isn't it the circular Dirichlet thingie and not just the straight sinc() interpolation as it would be for interpolating a linear set of values? r b-j
On Sun, 22 May 2016 09:28:18 -0700 (PDT), robert bristow-johnson
<rbj@audioimagination.com> wrote:

>On Sunday, May 22, 2016 at 12:18:25 PM UTC-4, Eric Jacobsen wrote: >> On Sat, 21 May 2016 19:05:21 -0500, "Cedron" <103185@DSPRelated> >> wrote: >> >> > .... 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. >> >.... >> > >> >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. > >isn't it the circular Dirichlet thingie and not just the straight sinc() interpolation as it would be for interpolating a linear set of values? > >r b-j
The output of any Fourier Transform of a finite-duration signal, continuous or discrete, quantized or not, is the convolution of the signal transform and the window function transform. A rectangular window has a sinx/x transform in both continuous and discrete forms, so the convolution of the dirac delta with the sinx/x provides the classic, well-understood sinx/x response of the FT. Since the math is consistent from the fundamentals for the continuous or discrete cases, it's a pretty basic characterstic of the FT. I know you know all that, but there may be others that don't. This is connected to the old debates on "inherent" window functions, which I don't really want to revisit, but it touches on the same stuff.
[...snip...]

>> >>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. >
Alright, why did you bring it up if it has no relevance to the discussion? [...snip...]
> >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. >
I did an internet search on "sinc function leakage" and looked at a bunch of sites. I included a reference to make it clear what I was talking about and to make sure it was what you were referring to as well. I chose this site for two reasons. The first was the cool interactive plots and the second was this quote: "The continuous frequency spectrum of a sampled sine wave is approximated by the Sinc function shown in Figure 2." This site, as well as all the others I looked at used real signals, so they must all not be competent. It looks like you are the only competent one. Oh wait, you are still wrong in the discrete complex case. The true, actual, correct, exact (T,A,C,E) formula is: abs[ sin( Pi*x ) / ( N*sin( Pi*x/N ) ) ] The Sinc (S) formula is an approximation (A) and a limit (L): abs[ sin( Pi*x ) / ( Pi*x ) ] I am using the normalized version so the units of x are bin intervals. Please note that: limit[N --> Infinity] N*sin( Pi*x/N ) = Pi*x Therefore the true equation approaches the normalized Sinc function as N gets larger. The exact formula took me less than a page of hand written algebra to derive. There was no Calculus, convolutions, or limits involved. No reference or reliance on the continuous case either. Here is another concrete numerical example: N = 16 S_n = exp[ i * ( 5.5 * n * 2Pi/N + 1.0 ) ] Bin Real Imag Mag T,A,C,E S,A,L x --- ------- -------- ------- ------- ------- ---- 0 0.00566 0.07064 0.07087 0.07087 0.05787 -5.5 1 -0.00939 0.08031 0.08085 0.08085 0.07074 -4.5 2 -0.03031 0.09374 0.09852 0.09852 0.09095 -3.5 3 -0.06462 0.11577 0.13258 0.13258 0.12732 -2.5 4 -0.13960 0.16391 0.21531 0.21531 0.21221 -1.5 5 -0.50021 0.39545 0.63764 0.63764 0.63662 -0.5 6 0.56774 -0.29027 0.63764 0.63764 0.63662 0.5 7 0.20714 -0.05873 0.21531 0.21531 0.21221 1.5 8 0.13216 -0.01059 0.13258 0.13258 0.12732 2.5 9 0.09785 0.01144 0.09852 0.09852 0.09095 3.5 10 0.07693 0.02488 0.08085 0.08085 0.07074 4.5 11 0.06188 0.03454 0.07087 0.07087 0.05787 5.5 12 0.04972 0.04235 0.06531 0.06531 0.04897 6.5 13 0.03895 0.04927 0.06280 0.06280 0.04244 7.5 14 0.02859 0.05592 0.06280 0.06280 0.03745 8.5 15 0.01782 0.06284 0.06531 0.06531 0.03351 9.5
>>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
One final item since I don't want to be accused of any "unadmitted assumptions". The formulas for the bin values for a real signal in my blog article are not valid for "in between the bins". This is due to the simplifying assumption I make in equation 16. This assumption could be ignored and a different equation could be derived which would be valid. Doing this would make equation 20 even messier. Ced --------------------------------------- Posted through http://www.DSPRelated.com
[...snip...]
> >The output of any Fourier Transform of a finite-duration signal, >continuous or discrete, quantized or not, is the convolution of the >signal transform and the window function transform. A rectangular >window has a sinx/x transform in both continuous and discrete forms, >so the convolution of the dirac delta with the sinx/x provides the >classic, well-understood sinx/x response of the FT. Since the math >is consistent from the fundamentals for the continuous or discrete >cases, it's a pretty basic characterstic of the FT. >
Based on the results I gave in the other reply it looks like you are going to have to roll back some of what you just said. You speak so authoritatively that I almost believe you.
>I know you know all that, but there may be others that don't. >
Nice argumentum ad populum.
>This is connected to the old debates on "inherent" window functions, >which I don't really want to revisit, but it touches on the same >stuff.
Another attempt at misdirection? You still haven't responded to my dismissal of the "whole finite-time observation thing". Ced --------------------------------------- Posted through http://www.DSPRelated.com
On Sun, 22 May 2016 21:20:47 -0500, "Cedron" <103185@DSPRelated>
wrote:

>[...snip...] >> >>The output of any Fourier Transform of a finite-duration signal, >>continuous or discrete, quantized or not, is the convolution of the >>signal transform and the window function transform. A rectangular >>window has a sinx/x transform in both continuous and discrete forms, >>so the convolution of the dirac delta with the sinx/x provides the >>classic, well-understood sinx/x response of the FT. Since the math >>is consistent from the fundamentals for the continuous or discrete >>cases, it's a pretty basic characterstic of the FT. >> > >Based on the results I gave in the other reply it looks like you are going >to have to roll back some of what you just said. You speak so >authoritatively that I almost believe you.
You don't have to believe me. What I wrote above is contained in many texts on signal processing and Fourier Transforms. Of course, you don't have to believe them, either.
>>I know you know all that, but there may be others that don't. >> > >Nice argumentum ad populum.
No, it was just a comment to rb-j about why I was responding to his post with things I know he already knows. Not everything is about you.
>>This is connected to the old debates on "inherent" window functions, >>which I don't really want to revisit, but it touches on the same >>stuff. > >Another attempt at misdirection? You still haven't responded to my >dismissal of the "whole finite-time observation thing".
No. Again, it was just a comment to rb-j about topics that have been discussed here in the past and how they related to my post to which he was responding. Again, it's not about you.
On Sun, 22 May 2016 21:17:43 -0500, "Cedron" <103185@DSPRelated>
wrote:

>[...snip...] > >>> >>>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. >> > >Alright, why did you bring it up if it has no relevance to the >discussion?
It had relevance to the discussion. You just missed it.
>[...snip...]
That's what I should have done.
[...snip...]
> >>[...snip...] > >That's what I should have done.
What is clearly missing from your replies is any reference to the equation I derived already being known. If you have any reference to this equation, you should still post it. If anybody else has one, it would be nice if you posted as well. Since it is clearly the correct model for the discrete case, and the Sinc function is not, if nobody can post a reference I probably ought to write up another blog article showing the derivation. Ced --------------------------------------- Posted through http://www.DSPRelated.com
On Mon, 23 May 2016 07:40:53 -0500, "Cedron" <103185@DSPRelated>
wrote:

>[...snip...] >> >>>[...snip...] >> >>That's what I should have done. > >What is clearly missing from your replies is any reference to the equation >I derived already being known. If you have any reference to this >equation, you should still post it. > >If anybody else has one, it would be nice if you posted as well. > >Since it is clearly the correct model for the discrete case, and the Sinc >function is not, if nobody can post a reference I probably ought to write >up another blog article showing the derivation. > >Ced >--------------------------------------- >Posted through http://www.DSPRelated.com
Since you seem to be unaware of the very large body of work already done in this area, I think you should start there. Perhaps look into topics like window functions.
> >Since you seem to be unaware of the very large body of work already >done in this area, I think you should start there. Perhaps look into >topics like window functions.
Your assumption is wrong, I am very familiar with it. The problem is that it is difficult to search it for the specific topics at issue. For instance, when I use the term "complex tone", the results come back with tons of references that are actually about "complicated tones". I have found many pages like the one I referenced earlier, but I have yet to find one pertaining to complex tones. This is a statement of yours that I have a big problem with: "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." I have yet to find any web page or paper that states that the Sinc function is the correct model for the side lobe magnitudes of a pure complex tone. If you know of one, please provide it. I have found plenty that say that the Sinc function and a rectangular window are Fourier pairs. Hey, I was a Calculus TA in college, I don't have a problem with that. I have a huge problem with this statement of yours: "Since the math is consistent from the fundamentals for the continuous or discrete cases, ..." The math is not consistent from the fundamentals. A summation is not the same as an integral. You cannot assume that you can go back and forth between the continuous case and the discrete case with the same formulas. Let me offer a different example to illustrate my point. Consider triangular numbers. X XX XXX XXXX There is a formula for the count of X's based on the number of rows. It is: Count = n * ( n + 1 ) / 2 Where n is the number of rows. In contrast, suppose you have a square of side length n and you cut it in half along the diagonal. There is a simple formula for the area of the triangle. It is: Area = n^2 / 2 The triangular numbers and the half square triangles are conceptually alike. The larger that n is, the more they are alike. Indeed, the area formula can be used as an approximation for the count formula. However, if I were to say "The area formula is the correct model for the triangular numbers", it would not only be misleading, but flat out wrong. You can also say: Count = Sum[ x = 1 to n ] of x You can even say: Count = Sum[ x = 0 to n ] of x * 1 Since adding zero doesn't change the sum. For the continuous case, any one familiar with Calculus will agree: Area = Integral[ x = 0 to n ] of x * dx They look alike, they behave alike, but they are not interchangeable. In order to disprove something in Math, all you need is a single counterexample. I have provided one that clearly shows that the Sinc function does not accurately model the side lobe magnitudes of a pure complex tone. In addition, I've also provided a function that does model them exactly. One example does not prove that, but the derivation does. Once again the formulas are: abs[ sin( Pi*x ) / ( N*sin( Pi*x/N ) ) ] abs[ sin( Pi*x ) / ( Pi*x ) ] They look alike, they behave alike, but they are not interchangeable. The distinction between continuous and discrete window functions can be a topic for a different day. Ced --------------------------------------- Posted through http://www.DSPRelated.com
On Sunday, May 22, 2016 at 10:28:21 PM UTC-4, Eric Jacobsen wrote:
> On Sun, 22 May 2016 21:20:47 -0500, "Cedron" <103185@DSPRelated> > wrote: > > >[...snip...] > >> > >>The output of any Fourier Transform of a finite-duration signal, > >>continuous or discrete, quantized or not, is the convolution of the > >>signal transform and the window function transform.
this premise needs to be clarified, or else i will say it's not true. Eric, i *know* we have (in this newsgroup) been over this time and again. it's repeating, but maybe not a periodic repeating argument we have here at comp.dsp. the type of signal being tranformed (discrete or continuous, finite or infinite length, periodic or aperiodic) decides which of the "any Fourier Transform[s]" are to be used. if the signal is uniformly-sampled discrete-time, then it's the DTFT if the length is infinite (and it's hard to program a computer to get a job done with an infinite number of computations) and it's the DFT if the length is finite. now, again our bone of contention is that i fascistically insist that when you pass that finite-length discrete-time data to the DFT, the DFT periodically extends it and we know in the past 2 decades, that you don't seem to agree with that. i take that position because i am convinced that the mathematics simply says that the DFT and DFS are the same thing. we have written ad nauseum about it, exchanged PDFs with math (can't find mine, but a restate the case at the DSP stack exchange: http://dsp.stackexchange.com/questions/18144/about-discrete-fourier-transform-vs-discrete-fourier-series ). but however you put it, Eric, the convolution you speak of here *must* be circular convolution with W[k] = sin(pi k)/(N sin(pi k/N)) or equivalently linear convolution with sinc(k) if X[k] is periodically extended. you get the same thing. (at least for odd N, i still have a problem with *some* application of the Dirichlet thingie for even N. for even N, i think it should be sin(pi n)/(N tan(pi n/N)). at least for the other direction and interpolating real, periodic signals. i still have never really gotten to the bottom of that discrepency between my understanding and the textbooks.) but you *don't* get the same thing if X[k] is not periodically extended and you linearly convolve with W[k]
> >> A rectangular > >>window has a sinx/x transform in both continuous and discrete forms, > >>so the convolution of the dirac delta with the sinx/x provides the > >>classic, well-understood sinx/x response of the FT. Since the math > >>is consistent from the fundamentals for the continuous or discrete > >>cases, it's a pretty basic characterstic of the FT. > >>
you gotta be more specific about the nature of the convolution. if you're convolving with the aperiodic sinc(pi k)/(pi k), then it has to be linear convolution on the *periodically extended* X[k]. an infinite summation of infinitely many non-zero terms. if that is not premised, then i have to disagree with you about the math.
> You don't have to believe me. What I wrote above is contained in > many texts on signal processing and Fourier Transforms. Of course, > you don't have to believe them, either.
> >>I know you know all that, but there may be others that don't. > >> > > > >Nice argumentum ad populum. > > No, it was just a comment to rb-j about why I was responding to his > post with things I know he already knows. Not everything is about > you.
yeah, but i wanna keep this about the mathematics. what are the *correct* precise mathematics about interpolating DFT data? (we won't be disagreeing much about the practical approximate mathematics.)
> >>This is connected to the old debates on "inherent" window functions, > >>which I don't really want to revisit, but it touches on the same > >>stuff. > > > >Another attempt at misdirection? You still haven't responded to my > >dismissal of the "whole finite-time observation thing". > > No. Again, it was just a comment to rb-j about topics that have been > discussed here in the past and how they related to my post to which he > was responding. > > Again, it's not about you.
no, it's not about Cedron or Eric or rb-j. i want this to be strictly about the mathematics of the DFT. r b-j