DSPRelated.com
Forums

Detect fundamental Frequency

Started by fredp January 7, 2008
Hello All,

I am trying to detect the fundamental frequency of a non-sinusoidal
waveform. I do FFT on the sampled data and I get a bunch of harmonics. How
should I go about to detect the fundamental frequency between the harmonic
signals?

Thank you


fredp wrote:

> Hello All, > > I am trying to detect the fundamental frequency of a non-sinusoidal > waveform. I do FFT on the sampled data and I get a bunch of harmonics. How > should I go about to detect the fundamental frequency between the harmonic > signals? > > Thank you > >
Look up definition of "fundamental" and "harmonic". IOW you didn't ask the question you meant to ask ;)
>fredp wrote: > >> Hello All, >> >> I am trying to detect the fundamental frequency of a non-sinusoidal >> waveform. I do FFT on the sampled data and I get a bunch of harmonics.
How
>> should I go about to detect the fundamental frequency between the
harmonic
>> signals? >> >> Thank you >> >> > >Look up definition of "fundamental" and "harmonic". >IOW you didn't ask the question you meant to ask ;) > >
Thanks Richard, Well let me try to clear things up. I have got a square waveform. When I put it in the frequency domain I get the fundamental frequency and harmonics ok? Lets say the partial harmonics are greater than the fundamental component, So the peak fft bin is not related to the fundamental freq but to the partial one. For example, if a waveform has three components at 2,4 and 6 Hz and assume that the 4 hz component is stronger than 2 hz.... Thanks
"fredp" <fredper@gmail.com> wrote in 
news:BrudnfrVXrBToR_anZ2dnUVZ_j6dnZ2d@giganews.com:

>>fredp wrote: >> >>> Hello All, >>> >>> I am trying to detect the fundamental frequency of a non-sinusoidal >>> waveform. I do FFT on the sampled data and I get a bunch of
harmonics.
> How >>> should I go about to detect the fundamental frequency between the > harmonic >>> signals? >>> >>> Thank you >>> >>> >> >>Look up definition of "fundamental" and "harmonic". >>IOW you didn't ask the question you meant to ask ;) >> >> > > Thanks Richard, > Well let me try to clear things up. I have got a square waveform. When
I
> put it in the frequency domain I get the fundamental frequency and > harmonics ok? Lets say the partial harmonics are greater than the > fundamental component, So the peak fft bin is not related to the > fundamental freq but to the partial one. For example, if a waveform has > three components at 2,4 and 6 Hz and assume that the 4 hz component is > stronger than 2 hz.... > > Thanks
For a square wave, why not use some sort of timing approach to estimate the period instead of dealing with the fft? -- Scott Reverse name to reply
On Jan 7, 9:53&#4294967295;am, "fredp" <fred...@gmail.com> wrote:
> For example, if a waveform has > three components at 2,4 and 6 Hz and assume that the 4 hz component > is stronger than 2 hz....
It's not at all uncommon for some harmonics, or even the fundamental, to be weak or missing entirely. In such cases you can often infer the fundamental frequency from the differences between the frequencies of the harmonics that are present. Greg
>"fredp" <fredper@gmail.com> wrote in >news:BrudnfrVXrBToR_anZ2dnUVZ_j6dnZ2d@giganews.com: > >>>fredp wrote: >>> >>>> Hello All, >>>> >>>> I am trying to detect the fundamental frequency of a non-sinusoidal >>>> waveform. I do FFT on the sampled data and I get a bunch of >harmonics. >> How >>>> should I go about to detect the fundamental frequency between the >> harmonic >>>> signals? >>>> >>>> Thank you >>>> >>>> >>> >>>Look up definition of "fundamental" and "harmonic". >>>IOW you didn't ask the question you meant to ask ;) >>> >>> >> >> Thanks Richard, >> Well let me try to clear things up. I have got a square waveform. When
>I >> put it in the frequency domain I get the fundamental frequency and >> harmonics ok? Lets say the partial harmonics are greater than the >> fundamental component, So the peak fft bin is not related to the >> fundamental freq but to the partial one. For example, if a waveform
has
>> three components at 2,4 and 6 Hz and assume that the 4 hz component is >> stronger than 2 hz.... >> >> Thanks > > >For a square wave, why not use some sort of timing approach to estimate >the period instead of dealing with the fft? > > >-- >Scott >Reverse name to reply >
Thanx Scott, Well, lets say we are dealing with a noisy waveform. Find the zero crossings wont be easy...

fredp wrote:


> I am trying to detect the fundamental frequency of a non-sinusoidal > waveform.
Looks like the pitch detection is one of the hottest topics ever.
> I do FFT on the sampled data and I get a bunch of harmonics. How > should I go about to detect the fundamental frequency between the harmonic > signals?
You need to apply the comb function to the output of the FFT. The comb period which maximizes the function is the fundamental frequency. Of course, there could be the usual problem with the detection of a subharmonic instead of the fundamental. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
"fredp" <fredper@gmail.com> wrote in 
news:1fSdnWMaJ9IJ3R_anZ2dnUVZ_jqdnZ2d@giganews.com:

> Thanx Scott, > Well, lets say we are dealing with a noisy waveform. Find the zero > crossings wont be easy... >
Can you fill us in a bit more? I hate to deal with half the inputs. Even with a noisy waveform, FFT might not be your best bet. There are many simple but effective things you can do with a digital conversion to clean things up, including simple filtering, Schmidt and Schottky triggering, simple debouncing, or even something like driving a phase locked loop with your square wave to get a cleaner square wave out. -- Scott Reverse name to reply
On Jan 7, 10:09 am, "fredp" <fred...@gmail.com> wrote:
> >"fredp" <fred...@gmail.com> wrote in > >news:BrudnfrVXrBToR_anZ2dnUVZ_j6dnZ2d@giganews.com: > > >>>fredp wrote: > > >>>> Hello All, > > >>>> I am trying to detect the fundamental frequency of a non-sinusoidal > >>>> waveform. I do FFT on the sampled data and I get a bunch of > >harmonics. > >> How > >>>> should I go about to detect the fundamental frequency between the > >> harmonic > >>>> signals? > > >>>> Thank you > > >>>Look up definition of "fundamental" and "harmonic". > >>>IOW you didn't ask the question you meant to ask ;) > > >> Thanks Richard, > >> Well let me try to clear things up. I have got a square waveform. When > >I > >> put it in the frequency domain I get the fundamental frequency and > >> harmonics ok? Lets say the partial harmonics are greater than the > >> fundamental component, So the peak fft bin is not related to the > >> fundamental freq but to the partial one. For example, if a waveform > has > >> three components at 2,4 and 6 Hz and assume that the 4 hz component is > >> stronger than 2 hz.... > > >> Thanks > > >For a square wave, why not use some sort of timing approach to estimate > >the period instead of dealing with the fft? >
sounds like what you need is what we call in the audio/music DSP world, a "pitch detection algorithm". like AMDF or ASDF or autocorrelation. (picking the correct extremal points is where the magic is.) r b=j
On Jan 7, 10:46 am, robert bristow-johnson <r...@audioimagination.com>
wrote:

> sounds like what you need is what we call in the audio/music DSP > world, a "pitch detection algorithm". like AMDF or ASDF or > autocorrelation.
Siimilarly, in the voice processing world there is, for example: RAPT (Robust Algorithm for Pitch Tracking), David Talkin, in "Speech Coding and Synthesis", edited by Kleijn and Paliwal. You'll find an implementation in the Matlab VoiceBox Toolkit, available from "http:// www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html". Finding a copy of the original article is extremely difficult, however. HPS (Harmonic Product Spectrum), M. R. Schroeder, "Period Histogram and Product Spectrum: New Methods for Fundamental-Frequency Measurement", The Journal of the Acoustical Society of America, Volume 43 Number 4, 1968. Greg