MFCC

Also known as: Mel-frequency cepstral coefficients

On this page 7

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.

StepOperationPurpose
Pre-emphasisFirst-order high-pass filter, coefficient about 0.97Boosts weak high frequencies
Framing and windowing25 ms frames with a Hamming windowTreats speech as locally stationary
Fourier transformFFT of each frame, usually 512 pointsYields the power spectrum
Mel filterbank20 to 40 overlapping triangular filtersGroups energy on a perceptual scale
LogarithmLog of each filter energyCompresses dynamic range like loudness perception
Discrete cosine transformDCT of the log energiesDecorrelates and compacts the envelope
TruncationKeep the first 12 or 13 coefficientsRetains envelope, drops fine pitch structure
Standard steps of MFCC extraction

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.

CoefficientTypical interpretationCommon handling
C0Overall frame energyOften replaced by log energy
C1Balance of low versus high frequenciesKept
C2 to C12Progressively finer envelope detailKept as the core feature set
C13 and aboveFine structure including pitch rippleUsually discarded for recognition
What individual MFCC coefficients tend to capture

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.

RepresentationDimensions per frameTypical useTrade-off
MFCC13 to 39GMM-HMM systems, speaker verification baselines, small modelsCompact but loses spectral locality
Log-mel spectrogram40 to 128Neural ASR, Conformer and Whisper-style modelsRicher but larger
Linear spectrogram257 or moreSpeech enhancement, source separationFull detail, high redundancy
PLP features13 to 39Older noise-robust recognizersSimilar to MFCC, more complex
Learned features256 to 1024Self-supervised models such as wav2vec 2.0Need large pretraining
MFCC and neighboring audio features

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.

SymptomLikely causeRemedy
Accuracy drops on new microphonesChannel offsetApply cepstral mean normalization
Poor results in noisy roomsNoise in low-energy bandsAdd noise augmentation or enhancement
Model fails after toolkit changeDifferent extraction defaultsFix and document every parameter
Weak emotion or pitch cuesPitch removed by truncationAdd pitch and energy features
Common MFCC problems and remedies

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.