On Fri, Apr 26, 2024 at 12:23:45PM +0200, Dominique Michel wrote: > From the start of a note, do You know how long it takes, or how much > periods of the signal it takes, in order to get the pitch?
For the autocorrelation (AC) to produce a usable result you need at least two periods - this will make the signal similar to itself shifted by one period. Also if the autocorrelation is computed using the FFT method (which is really the only efficient way), the FFT needs to be longer and windowed in order to avoid 'circular' effects [1]. Let's assume that the lowest frequency we want to detect is 75 Hz (between D2 and E2) or 640 samples at 48 khz sample rate. Twice the period is 1280, and to have a useful window you'd need again more or less the double. Zita-at1 uses a 2048 point FFT with a raised cosine window. So the pitch estimate is 1024 samples or about 21 ms behind the input. To have the most accurate pitch correction latency would need to be the same. Still 21 ms is faster than humans will perceive pitch, so one could reduce latency and accept the error. But this doesn't mean the error won't be perceived. [1] Assume a 1024 point FFT and a period of 300 samples. Without windowing the AC will peak at 300, but also at 1024 - 2 * 300 = 424 samples. The two peaks can easily merge into a single one somewhere in between. -- FA _______________________________________________ Linux-audio-dev mailing list -- linux-audio-dev@lists.linuxaudio.org To unsubscribe send an email to linux-audio-dev-le...@lists.linuxaudio.org