MFCC (mel-frequency cepstral coefficients) are a set of compact acoustic features that describe the short-term spectral envelope of a sound on a frequency scale modeled on human hearing. In Speech & language AI, MFCCs were for decades the default input representation for speech recognition, speaker recognition and audio classification, and they remain a strong baseline wherever data or compute is limited.
A typical MFCC vector contains 12 or 13 coefficients computed for every frame of about 25 milliseconds, advanced in 10 millisecond steps. Each vector summarizes the shape of the vocal tract at that instant, which carries most of the information that distinguishes one phoneme from another, while discarding much of the pitch detail that matters less for word identity.
How MFCCs are computed from a waveform
The MFCC pipeline converts raw samples into a decorrelated, low-dimensional description of the spectrum through a fixed sequence of signal processing steps. No learning is involved, which makes the features deterministic and reproducible across systems that use identical settings.
The table below lists the standard steps and the purpose of each one.
| Step | Operation | Purpose |
|---|---|---|
| Pre-emphasis | First-order high-pass filter, coefficient about 0.97 | Boosts weak high frequencies |
| Framing and windowing | 25 ms frames with a Hamming window | Treats speech as locally stationary |
| Fourier transform | FFT of each frame, usually 512 points | Yields the power spectrum |
| Mel filterbank | 20 to 40 overlapping triangular filters | Groups energy on a perceptual scale |
| Logarithm | Log of each filter energy | Compresses dynamic range like loudness perception |
| Discrete cosine transform | DCT of the log energies | Decorrelates and compacts the envelope |
| Truncation | Keep the first 12 or 13 coefficients | Retains envelope, drops fine pitch structure |
The mel scale spaces filters roughly linearly below about 1 kHz and logarithmically above it, mirroring the way the cochlea resolves frequency. The final DCT step produces the cepstrum, the spectrum of a log spectrum, in which slow variations across frequency (the envelope) occupy the lowest coefficients.
Why the cepstrum separates source and filter
Speech production follows the source-filter model: the vocal folds generate a periodic or noisy source, and the vocal tract shapes it like a filter. In the spectrum these two components are multiplied, but after taking the logarithm they are added, so a linear transform can separate them.
The vocal tract produces a smooth envelope with resonances called formants, which falls into the low cepstral coefficients. The pitch harmonics form a rapid ripple that lands in higher coefficients. Truncating to the first dozen coefficients therefore performs liftering, keeping articulation and discarding most speaker pitch.
The coefficient index carries a rough meaning, summarized below.
| Coefficient | Typical interpretation | Common handling |
|---|---|---|
| C0 | Overall frame energy | Often replaced by log energy |
| C1 | Balance of low versus high frequencies | Kept |
| C2 to C12 | Progressively finer envelope detail | Kept as the core feature set |
| C13 and above | Fine structure including pitch ripple | Usually discarded for recognition |
Dynamic features and normalization
Static coefficients describe a single frame, yet speech is defined by change over time. Classic systems append delta and delta-delta coefficients, the first and second time derivatives computed over a window of neighboring frames, producing the well-known 39-dimensional feature vector.
Cepstral mean and variance normalization (CMVN) subtracts the average of each coefficient over an utterance and scales it to unit variance. Because a fixed microphone or channel adds a constant offset in the log cepstral domain, mean subtraction removes much of the channel effect with almost no cost.
Configuration choices interact with the sampling rate. Telephone audio at 8 kHz usually uses about 23 filters up to 4 kHz, while wideband speech at 16 kHz commonly uses 40 filters up to 8 kHz. Streaming systems replace utterance-level CMVN with a sliding-window mean so that normalization does not require future audio. Some speaker verification pipelines keep 20 or more coefficients, because finer envelope detail carries speaker identity that word recognition deliberately ignores.
MFCCs compared with other audio representations
Modern neural systems increasingly skip the DCT and consume log-mel filterbank energies or even raw waveforms. The DCT was valuable for Gaussian mixture models with diagonal covariance, which require decorrelated inputs, but convolutional and transformer networks exploit the local correlations that the DCT removes.
| Representation | Dimensions per frame | Typical use | Trade-off |
|---|---|---|---|
| MFCC | 13 to 39 | GMM-HMM systems, speaker verification baselines, small models | Compact but loses spectral locality |
| Log-mel spectrogram | 40 to 128 | Neural ASR, Conformer and Whisper-style models | Richer but larger |
| Linear spectrogram | 257 or more | Speech enhancement, source separation | Full detail, high redundancy |
| PLP features | 13 to 39 | Older noise-robust recognizers | Similar to MFCC, more complex |
| Learned features | 256 to 1024 | Self-supervised models such as wav2vec 2.0 | Need large pretraining |
The close neighbor Mel spectrogram is, in effect, MFCC extraction stopped before the DCT. Choosing between them is mostly a question of the downstream model, not of information content.
Limitations and practical pitfalls
MFCCs are sensitive to additive noise, because noise fills low-energy filterbank channels and the logarithm amplifies those changes. Reverberation smears frames in time, which static coefficients cannot represent well. Practitioners also encounter implementation mismatches: libraries differ in filter shapes, mel formula variants, DCT normalization and liftering, so features from two toolkits are rarely interchangeable.
| Symptom | Likely cause | Remedy |
|---|---|---|
| Accuracy drops on new microphones | Channel offset | Apply cepstral mean normalization |
| Poor results in noisy rooms | Noise in low-energy bands | Add noise augmentation or enhancement |
| Model fails after toolkit change | Different extraction defaults | Fix and document every parameter |
| Weak emotion or pitch cues | Pitch removed by truncation | Add pitch and energy features |
A plain-language summary
When people speak, the shape of the mouth and throat changes the sound. An open mouth gives an “ah”. Rounded lips give an “oo”. MFCCs capture that shape as a short list of numbers.
A computer slices the recording into tiny pieces, each about one fortieth of a second long. For each piece it measures how much energy sits in different pitch bands, using bands spaced the way human ears hear. It then squeezes those measurements into about a dozen numbers. Those numbers act like a fingerprint of the sound at that moment, and a recognition model reads the sequence of fingerprints to work out the words.
An example from practice
An engineering team builds a keyword spotting system for a battery-powered home appliance that must react to a small set of spoken commands. The chip has very little memory and no room for a large neural network, so the team chooses 13 MFCCs per 10 ms frame with deltas, computed over a one-second sliding window.
They train a compact convolutional classifier on these features, applying cepstral mean normalization and adding recordings with kitchen noise to the training data. The resulting model fits in a few hundred kilobytes and runs continuously on the low-power processor. Testing in real kitchens shows that noise augmentation matters as much as the feature choice, and the product ships with reliable recognition of its command set.