On Nov 26, 2010, at 2:21 AM, Ross Bencina wrote:
robert bristow-johnson wrote:
you can have a periodic (or quasi-periodic) signal with absolutely
no energy at harmonic #1 (what i would call the fundamental), and
as long as it has energy in most other odd harmonics, the
autocorrelation function will work just as well. there will still
be peaks at lags are at integer multiples of the apparent period.
The way I see it, the ACF will be quasi-periodic at the rate of the
lowest present harmonic.
but that's not the case. if x(t) is periodic, then Rx(tau) (as
calculated with an infinitely large window) is periodic with the same
period.
a pretty robust definition of the autocorrelation of x(t) might be:
+T
Rx(tau) = lim{ 1/(2T) integral{ x(t)*x(t+tau) dt} }
T->inf -T
now, we don't have infinitely large windows to calculate Rx() with, so
as the lag, tau, increases the overlap of the windows is smaller
let
v(t) = x(t)*w(t) (w(t) is a very wide window function.)
then
Rx(tau) ~= Rv(tau)
+inf
Rv(tau) = integral{ v(t)*v(t+tau) dt}
-inf
so, while x(t) is periodic, v(t) is not and there is an envelope on
the apparent autocorrelation Rx(tau) which is:
+inf
Rw(tau) = integral{ w(t)*w(t+tau) dt}
-inf
if P is the period of x(t), then
x(t+P) = x(t) for all t
and
+inf
Rv(tau) = integral{ x(t)*w(t)*x(t+tau)*w(t+tau) dt}
-inf
+inf
Rv(P) = integral{ x(t)*w(t)*x(t+P)*w(t+P) dt}
-inf
+inf
= integral{ (x(t)^2)*w(t)*w(t+P) dt}
-inf
but
+inf
Rv(0) = integral{ (x(t)^2)*(w(t)^2) dt}
-inf
Rv(P) is reduced from Rv(0) because w(t)*w(t+P) is smaller than w(t)^2
because w(t) and w(t+P) do not overlap as much as w(t) overlaps on top
of itself. i think, for some windows (like the rectangular window),
you can show something like
Rv(n*P) = Rx(n*P)*Rw(n*P)
which is true only at the multiples of the period, P.
underneath that envelope, you will see peaks at multiples of the
period of x(t), whether there is 1st harmonic in there or not.
now there are other ways of computing the autocorrelation (or
something that looks like it) that do not have this envelope resulting
from windowing, so the autocorrelation peaks are as large as Rx(0) if
x(t) is perfectly periodic. the method shown with Rv(tau) is what you
would get if you were using the inverse FT of |v(t)|^2.
This doesn't tell you anything about what the fundamental is. The
peaks may be there, but how do you know which one(s) are related to
the fundamental?
there *is* the octave problem. you can have a tone of 360 Hz (with
all of the harmonics), but mathematically, it is also a tone of 180 Hz
(where all the odd harmonics have zero energy) or 120 Hz or 90 Hz
(with a lot of missing harmonics). the autocorrelation function will
peak at those periods also. so you look for the peak of sufficient
height (so, unfortunately, there is some kind of thresholding needed)
that has the smallest lag, which would be the one at 1/360 sec
--
r b-j r...@audioimagination.com
"Imagination is more important than knowledge."
--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp