Re: FFT of non-integer waveform
- From: "Fred Marshall" <fmarshallx@xxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 3 Feb 2006 10:58:15 -0800
"Ross Clement (Email address invalid - do not use)" <clemenr@xxxxxxxxxx>
wrote in message
news:1138808337.727873.120020@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi everyone. Suppose I have a sound sample digitised at say 44.1khz.
Say that I have identified a single cycle of a waveform and wish to
perform a fft so that I can understand the spectral content of the
waveform. What happens if I believe that the waveform starts in between
two of the samples and ends between another two samples. How do I then
use a discrete fourier transform to measure the spectral content. One
potential method is to ignore the non-integer starts, and fourier
transform the waveform using the nearest samples from the beginning and
the end. Another simple method would be to resample the waveform to a
much higher sampling rate so that I at least get nearer to the true
start and finish of the waveform.
Are there any techniques for this kind of problem?
Ross,
After reading the posts in this thread I'm wondering if you aren't trying to
"invent" something that's already done. Your situation remains a bit
unclear to me. Let me try to paraphrase it back:
Audio signal sampled at 44100Hz.
You have "identified a single cycle of the waveform".... hmmm. One must
wonder "how?"
OK - I guess maybe you're saying this:
"There is this periodic waveform that has a discernible fundamental
frequency. I want to know the frequency content of it"
Is that it?
Then you said:
"The waveform is bandpass filtered and should be close to a sine wave."
***OK so far.
"hence a cycle starts with a zero crossing, a maxima follows, another
zero crossing, a minima, and a final zero crossing."
***Well, you're going to get some push back from folks on this assertion.
It's simply semantics but probably important. A periodic waveform doesn't
have a start or an end because it's (theoretically) of infinite extent.
Otherwise it wouldn't be "periodic" in the analytical sense.
***Now, if you're saying that you have extracted a temporal epoch of a
signal, one that has a strong fundamental frequency component, and the
extraction is such that these properties apply for the epoch you've chosen,
then at least I understand that. Otherwise, there's this thing called
"phase" that depends on when you define time=0.
***To summarize, it sounds like you've defined time=0 such that the
extracted sequence of samples has a sine (not a cosine) as the fundamental
part. Well .... maybe.
"The positions of the starting and ending zero crossing can be reasonably
accurately
estimated by curve fitting in the neighbourhood of the crossing. The
signals are synthetic data and hence I know everything there is to know
about the signal."
***If that's the case then you don't need any further analysis. ???
"I'm interested in measuring the effects on measured
spectrum of distortion of the sine wave due to constantly changing
pitch and amplitude parameters."
***Much of this has been done analytically. See treatments of Modulation.
***The "distortion" comment bothers me a bit and may be worth discussing.
Normally "distortion" is defined relative to a pure sinusoid. Further, it's
normally defined as harmonic content - because a purely periodic waveform
can be constructed of sinusoids that are harmonically related (see Fourier
Series).
***Constantly changing pitch and amplitude implies the existence of other
frequencies. Some may be harmonically related and others not. At any rate
this situation would seem to make a "distortion" measurement relatively
meaningless. One method for measuring distortion is to remove the
fundamental component and see what's left - how much energy is left. Maybe
that's what you want? I don't even remember how it was done. Jerry
probably does though.
I'm left with this:
You have a signal that has a strong fundamental component.
You believe you can extract one period.
You want to analyze the content of that one period.
But, I don't know what your analysis objective really is......
Some cautions:
Some waveforms aren't periodic because they contain frequencies that aren't
rationally related. A sum of two components: 1Hz and piHz is an example.
Some will point out that if you look over enough time then the sum will
appear to be a single cycle. The more time, the less error but there's
still an error.
Whatever the waveform that's generated, it should be bandlimited before
sampling to avoid aliasing. You say this is audio, so that should be OK at
44100Hz. But, you also say that it's a generated signal. So, the amplitude
and phase changes generated may cause the bandwidth to approach or exceed
22050Hz and that might be a problem.
As Jerry points out, axis crossing measurements are iffy.
Have you considered doing this:
Select an *arbitrary* temporal epoch. As long as you can stand and still
observe the dynamics you want to study. Example: 1 second of data.
Zero pad the data in that epoch as much as you can. Example: zero pad out to
10 seconds.
FFT the padded sequence.
The result will have an apparent resolution of 0.1Hz on a real resolution of
1Hz. So, the spectrum will be interpolated by a factor of 10.
Now, compare this approach with one that actually does a good job of
extracting a temporal epoch of a presumed fundamental (and it doesn't matter
much when it starts and ends relative to the phase of the fundamental). The
FFT then starts to look like a Fourier Series calculation.
1) In this case, if you *don't* zero pad the data then you will get
coefficients that are much the same as you'd get by computing a Fourier
Series - less scaling differences. That defines a purely periodic
waveform - it's as if you have assumed that the period that was captured is
one period of an infinite number of periods.
2) If you *do* zero pad the data (let's say by a factor of 10) then you will
get coefficients that interpolate those above and it will seem that the
resolution is higher - even though it really isn't there are just more data
points to look at. Anyway, this approach will cause you to see frequency
components in between those of the "Fourier Series" coefficients from above.
They will partly be caused by spectral leakage of the FFT caused by the
shorter window / epoch length relative to the padded sequence length.
3) Now, another experiment: Using the same data source and time frame as
the first epoch above , take 10 cycles (lets say the same original cycle, 4
before the original, the original and 5 after it) and compute the FFT.
The result will be similar to what you saw in step 2 except now you have
real resolution instead of an interpolated version of what you got in step
1.
4) Now, another experiment: Let's assume that you really didn't do a
perfect job of selecting the temporal epoch. Using the same data source and
time frame as the first epoch above, take 10 cycles as in (3) with one
variation: change the number of samples taken as though your estimate of
the cycle period had changed. Do this for a number of cases above and below
the original period length. FFT each case.
- the best match to the underlying period will have a "peaky" spectrum with
peaks at the actual / measured / FFT estimated fundamental frequency and its
harmonics.
- poorer matches will have more energy between those frequencies.
- ideally, the peaks will be at the same frequencies subject to estimation
error.
I hope this helps.
Fred
.
- Follow-Ups:
- Re: FFT of non-integer waveform
- From: Jerry Avins
- Re: FFT of non-integer waveform
- From: Ross Clement (Email address invalid - do not use)
- Re: FFT of non-integer waveform
- References:
- FFT of non-integer waveform
- From: Ross Clement (Email address invalid - do not use)
- FFT of non-integer waveform
- Prev by Date: Re: Testing the speed of the fft on DSP TMS320c6711 (with CCS 3.1 device cycle accurate simulator) , are the times reasonable?
- Next by Date: Re: Small, Battery powered DSP boards with support via PC
- Previous by thread: Re: FFT of non-integer waveform
- Next by thread: Re: FFT of non-integer waveform
- Index(es):
Relevant Pages
|