From Spectrum to Cepstrum in Audio Processing
Explains the mathematical relationship among spectrum, log spectrum, cepstrum, and MFCC. Homomorphic processing, the quefrency domain, and limits in speech feature extraction are discussed.
The cepstrum of a signal is not the inverse of its spectrum. A cepstral representation is obtained by applying a second transform to the logarithmic form of the spectrum. This distinction is important for resolving a common conceptual confusion in speech-processing terminology. The spectrum shows how signal energy is distributed across frequencies. The cepstrum makes it possible to examine slow and rapid variations in the spectrum on a different axis.
I first encountered the cepstrum while examining the source code of open-source speech-recognition systems. These investigations, ranging from older systems such as CMU PocketSphinx to Kaldi, Vosk, and newer structures similar to Whisper, allowed me to see not only the theoretical definitions of concepts in the speech-processing chain but also their counterparts in real implementations. While developing my own audio-processing library, I also drew on the feature-extraction approaches of Python libraries such as spafe and librosa.
During my graduate studies, I concentrated on audio and image processing in digital forensics. I conducted research, developed software, and transferred the resulting experience into an academic book. The relationship among spectrum, cepstrum, the Mel scale, and linear prediction was one of the subjects I examined most closely during this work.
From spectrum to cepstrum
Over short intervals, a speech signal can be modeled as the combination of a sound source and the vocal tract. In a simplified source-filter model, the vocal cords produce an excitation. The vocal tract, formed by the oral and pharyngeal cavities, filters this excitation.
The time-domain relationship can be written as:
x[n] = e[n] X h[n]
Here, e[n] is the excitation signal, h[n] is the impulse response of the vocal tract, and x[n] is the observed speech signal. The X symbol denotes convolution.
After the Fourier transform, convolution becomes multiplication in the frequency domain:
X[k] = E[k] H[k]
Taking the logarithm of the magnitude spectrum converts the multiplicative relationship into an additive one:
log |X[k]| = log |E[k]| + log |H[k]|
The fundamental engineering value of cepstral analysis appears here. Source and filter components are mixed in the time domain and in the linear spectrum. In the logarithmic spectrum, they are represented additively. When an inverse Fourier transform is applied to the logarithmic spectrum, the components can become concentrated in different regions of the cepstral axis according to their rates of variation.
A common definition of the real cepstrum is:
c[n] = IDFT{log |DFT{x[n]}|}
Some definitions use the power spectrum instead of magnitude:
c[n] = IDFT{log |X[k]|²}
These two expressions do not produce the same scaling. A software library should therefore state explicitly which definition it uses when calculating a cepstrum or power cepstrum.
Although the unit of the cepstral axis resembles time, it is not directly a physical delay axis. The literature uses the term quefrency for this axis. If the sampling frequency is fs, the approximate value corresponding to cepstral sample n is:
q_n = n / f_s
A periodic spectral structure can create a peak in the cepstrum around the quefrency corresponding to that period. For a periodic speech signal with fundamental frequency F0, the expected peak lies approximately around 1 / F0. This relationship allows the cepstrum to be used for pitch and fundamental-frequency estimation.
Finding a cepstral peak does not produce a reliable F0 estimate under all conditions. Noise, weakened harmonics, multiple speakers, short frame selection, and unvoiced sounds affect the result. Cepstral pitch analysis should be used with a defined search interval and a voicing decision.
Origin of the terminology
The term cepstrum was used in a 1963 paper by Bogert, Healy, and Tukey. The paper had a broader focus than speech recognition. Its purpose was to examine echoes and periodic spectral structures in time series.
The word cepstrum was created by altering the first part of spectrum. The same wordplay was applied to related terms:
cepstruminstead ofspectrumquefrencyinstead offrequencyrahmonicsinstead ofharmonicslifteringinstead offilteringsapheinstead ofphase
These terms are not equally common in modern literature. Cepstrum, quefrency, and liftering still appear regularly in technical writing. Rahmonics has more limited use. Saphe and saphe cracking are found mainly in historical accounts of the cepstrum or texts that retain the original terminology.
Liftering refers to filtering performed in the cepstral domain. Its name was derived by rearranging letters in filtering. A lifter that preserves low-quefrency components can emphasize the spectral envelope. An operation that preserves high-quefrency components can emphasize harmonic structure and rapid spectral variation.
This separation in the cepstral domain is not ideal. Source and filter components do not have perfectly distinct boundaries in every signal. Low- and high-quefrency regions can overlap. Liftering is not a method that separates physical components perfectly. It is a cepstral filtering operation that selects particular rates of variation.
Types of cepstrum
Cepstrum does not refer to a single mathematical representation. Different cepstrum types exist according to the spectral information and transformation method used.
The real cepstrum uses the logarithm of the magnitude spectrum:
c_r[n] = IDFT{log |X[k]|}
Because phase is not included, the original signal cannot always be recovered from the real cepstrum. This representation is suitable for spectral-envelope, echo, and periodicity analysis.
The power cepstrum is commonly defined either through the squared magnitude of the inverse-transform result or through a transform of the log power spectrum. Definitions can differ among sources and libraries. Because different scalings can appear under the same name, implementation details should be examined before results are compared directly.
The complex cepstrum uses both magnitude and phase information from the logarithmic spectrum:
c_c[n] = IDFT{log X[k]}
Phase must be unwrapped before the complex logarithm can be calculated. Direct use of wrapped phase creates discontinuities. Phase unwrapping attempts to correct 2π jumps between successive phase values. When this operation is incorrect, the complex cepstrum is also incorrect.
Under suitable conditions, the complex cepstrum can be used for homomorphic system analysis and examination of minimum-phase components. It carries more information than the real cepstrum but is numerically more sensitive.
Its place in speech features
The best-known use of cepstral representations in speech-recognition systems is the Mel-frequency cepstral coefficient. In an MFCC pipeline, the speech signal is first divided into short frames. The spectrum of each frame is calculated. Spectral energy passes through filter banks arranged according to the Mel scale. After the logarithm of the filter energies is taken, a discrete cosine transform is applied.
A simplified MFCC calculation can be written as:
E_m = Σ_k |X[k]|² H_m[k]
L_m = log(E_m + ε)
c_r = Σ_m L_m cos[πr(m + 1/2) / M]
H_m[k] denotes Mel filter m. M is the number of filters. c_r is MFCC coefficient r.
MFCC is not a direct calculation of the real cepstrum. It uses logarithmic energy values from a Mel filter bank instead of the complete Fourier spectrum. It then applies, most often, a type-II discrete cosine transform rather than an inverse Fourier transform. The method is described as cepstral because it represents the logarithmic spectral envelope through low-dimensional cosine components.
Linear-prediction cepstral coefficients transfer coefficients obtained from a linear-prediction model into the cepstral domain. LPCC is related to a linear-prediction approach that represents speech production as an all-pole filter model. MFCC is based on perceptual frequency scaling, whereas LPCC is derived from a parametric vocal-tract model.
These two feature types do not produce the same information. Their behavior differs under noise, channel effects, sampling frequency, and speaker variation. The more appropriate representation depends on the acoustic-model type, training data, and operating environment.
Cepstral coefficients provide a low-dimensional, manageable feature vector. Information is nevertheless lost during compression. Phase information, fine harmonic detail, and high-order spectral variation are not preserved in most MFCC configurations. This loss can be useful in classical speech-recognition systems because the system becomes less sensitive to detail that is not directly related to phonetic classification.
Newer speech models do not have to use cepstral coefficients. Some systems operate on log-Mel spectrograms, while others work directly on waveforms. This change does not make the cepstrum invalid. As a model's feature-learning capacity grows, some manually designed compression steps can be delegated to the neural network.
From source code to concept
Examining cepstral processing only through formulas hides many implementation details. Frame length, window function, Fourier-transform size, spectrum normalization, logarithm base, and the floor used for zero energy all affect the result.
The source code of projects such as PocketSphinx, Kaldi, and Vosk shows how theoretical feature-extraction chains are implemented in production systems. In these systems, MFCC calculation is not isolated. Sampling, pre-emphasis, framing, energy calculation, cepstral mean normalization, and temporal derivatives are parts of the same preprocessing chain.
Libraries such as spafe and librosa provide accessible implementations for experimental work. Feature extractors invoked under the same name in two libraries can still have different default parameters. The filter-bank definition, DCT normalization, use of the first coefficient, and inclusion of energy in the vector affect the result.
If a model was trained with a specific MFCC configuration, the same processing sequence should be preserved in production. A small difference in windowing or normalization changes the feature distribution. The acoustic model may receive a mathematically valid vector that nevertheless differs from the distribution seen during training.
While developing my own audio-processing library, these details made it clear that a cepstral representation is not merely a few formulas. Reliability depends on applying transformations in the correct order and preserving numerical choices consistently. The theoretical background from my academic work and the engineering decisions I observed in open-source source code complemented each other at this point.
Engineering meaning of the terminology
Cepstral terminology can initially look like scientific wordplay. The terms persisted not because the names were interesting but because the operations they represent are useful. The logarithmic spectrum converts multiplicative components into additive components. The second transform moves the spectral envelope and faster spectral variations into different quefrency regions. Liftering then allows these regions to be selected.
This framework can be used in different forms for speech recognition, audio modeling, fundamental-frequency estimation, echo analysis, and forensic audio examination. Not every application uses the same cepstrum definition or coefficient set. The method name alone is not a sufficient technical description. The transform type, parameters, and preserved information should be stated explicitly.
The relationship between cepstrum and spectrum should therefore not be interpreted as an inverse relationship. Cepstrum is another representation space derived from the spectrum. It reorganizes structures from the frequency axis on the quefrency axis, making selected signal components easier to examine directly.
The historical creativity of cepstral terminology should not overshadow the mathematical method. Its engineering value comes from its approximate separation of source and filter effects in speech production and its conversion of high-dimensional spectral information into manageable features. Open-source code, academic work, and my own software-development process showed that this transformation is far more than a theoretical curiosity.
References
Bogert, B. P., Healy, M. J. R., and Tukey, J. W. (1963). The quefrency analysis of time series for echoes: Cepstrum, pseudo-autocovariance, cross-cepstrum and saphe cracking. Proceedings of the Symposium on Time Series Analysis, 209-243.
Oppenheim, A. V., and Schafer, R. W. (2004). From frequency to quefrency: A history of the cepstrum. IEEE Signal Processing Magazine, 21(5), 95-106. https://doi.org/10.1109/MSP.2004.1338001 (https://doi.org/10.1109/MSP.2004.1338001)
Rabiner, L. R., and Schafer, R. W. (1978). Digital Processing of Speech Signals. Englewood Cliffs, NJ: Prentice-Hall.
Quatieri, T. F. (2002). Discrete-Time Speech Signal Processing: Principles and Practice. Upper Saddle River, NJ: Prentice-Hall.
Deller, J. R., Proakis, J. G., and Hansen, J. H. L. (1993). Discrete-Time Processing of Speech Signals. New York, NY: Macmillan.
Köker, M. A. (2024). Adli Bilişimde Ses ve Görüntü İşleme Teknikleri. Istanbul: Akademik Yayıncılık.
SuperKogito. spafe: Simplified Python Audio Features Extraction. GitHub (https://github.com/SuperKogito/spafe)
McFee, B., et al. librosa: Python library for audio and music analysis. GitHub (https://github.com/librosa/librosa)
Shmyrev, N. V. Vosk Speech Recognition Toolkit. GitHub (https://github.com/alphacep/vosk-api)