Forums

Analyzing Cross Spectrum for Pitch.

Started by MatthewA May 17, 2016
Hiya friends!

I've got a pretty good cross spectrum happening here.  For some reason, I'm still getting false second harmonic readings but hey...  Anyway, so far I'm just searching for the top magnitude and finding the frequency of the bin.

I'm wondering if, once I've found around where a frequency is, if there's a way to hone in on it using phase, etc.  I know if I run a narrow band pass I can hear the difference between the bin pitch and the actual pitch, so I feel like it'd follow that one could calculate the difference.

Any ideas?
On 17.05.2016 9:38, MatthewA wrote:
> Hiya friends! > > I've got a pretty good cross spectrum happening here. For some reason, I'm still getting false second harmonic readings but hey... Anyway, so far I'm just searching for the top magnitude and finding the frequency of the bin.
Hi! Was that perhaps a metaphor for life or something?
> I'm wondering if, once I've found around where a frequency is, if there's a way to hone in on it using phase, etc. I know if I run a narrow band pass I can hear the difference between the bin pitch and the actual pitch, so I feel like it'd follow that one could calculate the difference. > > Any ideas? >
There are lots of ways for fine frequency estimation after an FFT (if I've understood the question correctly). The simplest options are zero-padding the time-series before the FFT (so you just have smaller bins after the FFT) or obtaining smaller frequency bins by means of interpolating FFT results (instead of zero-padding the time series). Also, one can find the true frequency value by fitting three FFT bins near the maximum value with a parabola. That option is discussed e.g. in "Understanding DSP" by Lyons. Gene
On 17.05.2016 10:40, Evgeny Filatov wrote:
> On 17.05.2016 9:38, MatthewA wrote: >> Hiya friends! >> >> I've got a pretty good cross spectrum happening here. For some >> reason, I'm still getting false second harmonic readings but hey... >> Anyway, so far I'm just searching for the top magnitude and finding >> the frequency of the bin. > > Hi! Was that perhaps a metaphor for life or something? > >> I'm wondering if, once I've found around where a frequency is, if >> there's a way to hone in on it using phase, etc. I know if I run a >> narrow band pass I can hear the difference between the bin pitch and >> the actual pitch, so I feel like it'd follow that one could calculate >> the difference. >> >> Any ideas? >> > > There are lots of ways for fine frequency estimation after an FFT (if > I've understood the question correctly). The simplest options are > zero-padding the time-series before the FFT (so you just have smaller > bins after the FFT) or obtaining smaller frequency bins by means of > interpolating FFT results (instead of zero-padding the time series). > > Also, one can find the true frequency value by fitting three FFT bins > near the maximum value with a parabola. That option is discussed e.g. in > "Understanding DSP" by Lyons. > > Gene >
There are literally tons of algorithms for estimating frequency of a single tone which work in time domain (many of them use phase). But there are several key ideas/algorithms most people use (and many newer algorithms are some variations of these). You can learn about them from a classic work, the 1998 article "Feedforward frequency estimation for PSK: A tutorial review" by Morelli and Mengali. HTH. Gene
On Tuesday, May 17, 2016 at 2:38:59 AM UTC-4, MatthewA wrote:
> > I've got a pretty good cross spectrum happening here. For some reason, I'm still getting false second harmonic readings but hey... Anyway, so far I'm just searching for the top magnitude and finding the frequency of the bin. >
crappy method of pitch detection.
> > Any ideas?
don't use FFT for pitch detection. use something like autocorrelation or AMDF. take a look at: http://miracle.otago.ac.nz/tartini/papers/A_Smarter_Way_to_Find_Pitch.pdf r b-j
[...snip...]
> >Also, one can find the true frequency value by fitting three FFT bins >near the maximum value with a parabola. That option is discussed e.g. in
>"Understanding DSP" by Lyons. > >Gene
Sorry, this is another estimator, not a "true" value. A formula for the true value can be found in my blog article titled "Exact Frequency Formula for a Pure Real Tone in a DFT" which is located here: https://www.dsprelated.com/showarticle/773.php In the Afterword, you will find a link to a paper which compares this formula to many others in the presence of noise. This formula does not have to be evaluated near the peak either, though it is more precise if it is. Whether the precision of an exact formula is worth the extra computations compared to a good estimator depends on the cost of computation, the accuracy of your data, and the level of noise in the signal. Ced --------------------------------------- Posted through http://www.DSPRelated.com
On 18.05.2016 15:24, Cedron wrote:
> [...snip...] >> >> Also, one can find the true frequency value by fitting three FFT bins >> near the maximum value with a parabola. That option is discussed e.g. in > >> "Understanding DSP" by Lyons. >> >> Gene > > Sorry, this is another estimator, not a "true" value. >
I stand corrected. Gene
On Tuesday, May 17, 2016 at 2:38:59 AM UTC-4, MatthewA wrote:
> Hiya friends! > > I've got a pretty good cross spectrum happening here. For some reason, I'm still getting false second harmonic readings but hey... Anyway, so far I'm just searching for the top magnitude and finding the frequency of the bin. > > I'm wondering if, once I've found around where a frequency is, if there's a way to hone in on it using phase, etc. I know if I run a narrow band pass I can hear the difference between the bin pitch and the actual pitch, so I feel like it'd follow that one could calculate the difference. > > Any ideas?
Dude, Never ever use FFT for pitch estimation ! http://www.google.com/patents/US7124075 Don't forget to write a check :-)
On Thursday, May 19, 2016 at 5:57:32 AM UTC-7, Evgeny Filatov wrote:
> On 18.05.2016 15:24, Cedron wrote: > > [...snip...] > >> Also, one can find the true frequency value by fitting three FFT bins > >> near the maximum value with a parabola. That option is discussed e.g. in
> >> "Understanding DSP" by Lyons.
> >> Gene
> > Sorry, this is another estimator, not a "true" value.
> I stand corrected. > Gene
Actually, any calculation performed on real world sampled data is an estimator except to the intellectually dishonest, or impaired, who expect that -you- live in -their- imaginary world that they don't reveal (or perhaps understand) the details of. Estimators are often chosen in the real world because they are more accurate than proposed "true" value formulas that make unadmitted assumptions that are not met. Dale B. Dalrymple
On 19.05.2016 23:38, dbd wrote:
> On Thursday, May 19, 2016 at 5:57:32 AM UTC-7, Evgeny Filatov wrote: >> On 18.05.2016 15:24, Cedron wrote: >>> [...snip...] >>>> Also, one can find the true frequency value by fitting three FFT bins >>>> near the maximum value with a parabola. That option is discussed e.g. in > >>>> "Understanding DSP" by Lyons. > >>>> Gene > >>> Sorry, this is another estimator, not a "true" value. > >> I stand corrected. >> Gene > > Actually, any calculation performed on real world sampled data is an estimator except to the intellectually dishonest, or impaired, who expect that -you- live in -their- imaginary world that they don't reveal (or perhaps understand) the details of. Estimators are often chosen in the real world because they are more accurate than proposed "true" value formulas that make unadmitted assumptions that are not met. > > Dale B. Dalrymple >
Indeed, there's no way to estimate true frequency of a noisy sinusoid. What you care about is whether your estimator attains the CRB (among other questions). I agreed with him because Cedron's claim may be correct (I don't know anything about his estimator) in the case of infinite SNR, which corresponds to CRB = 0. Which is, of course, utterly unrealistic, unless you are dealing with a mathematical model of something. Gene
On Fri, 20 May 2016 00:00:57 +0300, Evgeny Filatov
<e.v.filatov@ieee.org> wrote:

>On 19.05.2016 23:38, dbd wrote: >> On Thursday, May 19, 2016 at 5:57:32 AM UTC-7, Evgeny Filatov wrote: >>> On 18.05.2016 15:24, Cedron wrote: >>>> [...snip...] >>>>> Also, one can find the true frequency value by fitting three FFT bins >>>>> near the maximum value with a parabola. That option is discussed e.g. in >> >>>>> "Understanding DSP" by Lyons. >> >>>>> Gene >> >>>> Sorry, this is another estimator, not a "true" value. >> >>> I stand corrected. >>> Gene >> >> Actually, any calculation performed on real world sampled data is an estimator except to the intellectually dishonest, or impaired, who expect that -you- live in -their- imaginary world that they don't reveal (or perhaps understand) the details of. Estimators are often chosen in the real world because they are more accurate than proposed "true" value formulas that make unadmitted assumptions that are not met. >> >> Dale B. Dalrymple >> > >Indeed, there's no way to estimate true frequency of a noisy sinusoid. >What you care about is whether your estimator attains the CRB (among >other questions). > >I agreed with him because Cedron's claim may be correct (I don't know >anything about his estimator) in the case of infinite SNR, which >corresponds to CRB = 0. Which is, of course, utterly unrealistic, unless >you are dealing with a mathematical model of something.
And if it's a numeric model with quantized samples there will be, at a minimum, quantization noise. Plus the whole finite-time observation thing. So, yeah, they're all estimators.