Quefrency (source code)

= Quefrency
{title2=$q$}

<Quefrency> is the independent coordinate of a <cepstrum>. When a <cepstrum> is obtained by an inverse <Fourier transform> of a logarithmic magnitude spectrum expressed as a function of <frequency> in hertz, its <quefrency> coordinate has units of time. A repeated pattern across frequency can consequently appear at the corresponding reciprocal spacing on the <quefrency> axis.<Spectral Audio Signal Processing by Julius O. Smith III>[Spectral Envelope Extraction, Cepstral Windowing, equation 11.2: inverse transform of log spectral magnitude]{ref}

For an $N$-point <discrete Fourier transform> with <sampling rate> $f_s$, bin spacing is $\Delta f=f_s/N$. The inverse-transform coordinate at index $n$ has <quefrency>
$$
q_n=\frac{n}{N\Delta f}=\frac{n}{f_s}.
$$
With $f_s=8000\,\mathrm{Hz}$, index 40 represents $5\,\mathrm{ms}$. An ideal echo delayed by 40 samples generates spectral ripples spaced by $1/(0.005\,\mathrm s)=200\,\mathrm{Hz}$ and a <cepstrum> contribution at that $5\,\mathrm{ms}$ delay, with further contributions at its multiples. The <cepstrum>'s real-valued convention can also produce mirrored peaks at negative <quefrencies>.

A $5\,\mathrm{ms}$ <quefrency> peak is therefore not a $5\,\mathrm{ms}$-period oscillation of the original waveform by definition. Depending on the <signal>, it might reflect an echo or a <fundamental frequency> near $200\,\mathrm{Hz}$. Interpretation requires a model of how the spectral repetition arose.