# How to prevent Octave Jumping in ACF of Speech Signal?

I'm working with speech signals and my aim is to estimate the fundamental frequency
$\ F_0$ of this signal often called as "pitch".

The main idea is taking small blocks of the speech signal such that stationary can be assumed. Then calculating the autocorrelation function (ACF) of this block of a speech signal and finding index the global maximum of the ACF (except at zero) which refers to fundamental frequency.

But in the text it is stated that :

The global maximum might not be at the lag corresponding to the true fundamental frequency but can possibly be an integer multiple of it. Due to this, the maximum can jump in consecutive frame between lags corresponding to multiples of T0 leading also to jumps in the F0-estimate. These effects are called octave-jumps.

My questions arise at this point: How does octave jumps occur? What is the possible reason? I know that ACF is a periodic function since original time sequence is periodic and in my opinion, this period equals to the block length of the original speech signal we are working on. When I investigate the interval, first period of the ACF, how can I decide whether the maximum is refers to the pitch or it is a maximum shifted from the consecutive period (block)? How can ı prevent from this effect?

• take a look at this. and this. – robert bristow-johnson May 11 '18 at 19:14
• the main problem is that sometimes a sub-harmonic gets in there and causes your autocorrelation (or AMDF or ASDF) to spuriously go down an octave. but if you bias the algorithm to be resistant to that octave down error, then there may be times that it spuriously jumps up an octave (because the sinusoidal component at your true fundamental frequency is too weak). – robert bristow-johnson May 11 '18 at 19:17

Octave jumps down can occur if there is more noise (or other modulation) around a sub-harmonic of the pitch frequency, than at pitch.

Octave jumps upwards can occur if the timbre contains strong overtone or harmonic sequences and weak or nearly missing spectrum at or around the fundamental pitch frequency. Noise, or a non-flat frequency response in the acoustic environment or channel, can also add power to an overtone peak.

Windowing effects in the ACF can add noise which can increase the probability of the above estimation errors.

Humans might be infering octave by using using preceding or following pitch, timbres, and transients to error correct spurious jumps in the time-local spectrum.

Octave errors are common in autocorrelation or FFT based pitch detectors. The ACF shows peaks at multiples of the period. The autocorrelation method chooses the highest non-zero-lag peak by searching within a range of lags. If the higher limit is large enough, it may erroneously choose a higher-order peak. One way to avoid this is to use the following definition of the ACF

$$r_t(\tau) = \sum_{j=t+1}^{t+W-\tau} x(j)x(j+\tau)$$ where $$\tau$$ is the lag at time index $$t$$ and $$W$$ is the window size. This definition ensures that your ACF tapers off with increasing lag values, so there is less chance of detecting a harmonic as the fundamental.

YIN is a pitch detector which overcomes some flaws of the ACF method by defining a difference function, and normalizing it such that it remains large at low lags, and drops at larger lags, thus avoiding octave errors.

$$d_t(\tau) = \sum_{j=1}^W (x(j) - x(j+\tau))^2$$ $$d'_t(\tau) = \begin{cases} 1 ,& \tau = 0 \\ d_t(\tau)/\frac{1}{\tau} \sum_{j=1}^\tau d_t(j), & \tau \neq 0 \end{cases}$$ You can now look for the largest peak in this modified difference function to find the pitch.