As a preamble, I'll note that I posted a question on chuck-dev about AutoCorr/XCorr always crashing for me. This patch seems to fix that.
That said, I don't understand the results I get from AutoCorr. For periodic inputs, I expect to see periodicity in the output. For small FFT sample sizes, I see the expected peak at 0, and at large sample sizes I see a second peak at the end of the window. See example plots at
128 and
4096. That second peak is correlated with the window size, not the input frequency.
Here's the plotting code if anyone would like to repro:
SinOsc s => FFT fft =^ AutoCorr c => blackhole;
4400 => s.freq;
128 => fft.size;
300::ms => now;
c.upchuck();
Plot plot;
"autocorrelation of 4400 hz, 128 samples" => plot.title;
plot.plot(c.fvals());
200::ms => now;
Should I be using AutoCorr differently? Am I looking at the power spectrum or something, and not the correlation vector like I think I am? My current understanding comes from reading uana_extract.cpp many times with references like
this.
Thanks,
Curtis