ComfyUI Node

LFCC

MFCC's linear-frequency sibling, and the one anti-spoofing research actually prefers

By kale4eat·Created 2 years ago·Updated about a year ago· 23
LFCC
  • audio
  • spec
n_filter128
n_lfcc40
n_fft1024
win_length-1
hop_length512

Linear-Frequency Cepstral Coefficients are MFCC's less famous sibling - same overall recipe, one key difference: the filterbank is spaced linearly across frequency instead of warped to the mel scale. That sounds like a minor detail, but it's the reason LFCC shows up as a standard baseline feature specifically in speech spoof/deepfake detection research (the ASVspoof challenges being the best-known example): mel spacing deliberately compresses high-frequency detail to match human perception, and a lot of the artifacts that give away synthetic or vocoded speech live exactly in that high-frequency region mel scaling throws away. If your dataset work is aimed at anti-spoofing or synthetic-speech detection rather than general speech recognition, LFCC is the more deliberate choice over MFCC.

How it works

Same pipeline shape as MFCC: STFT the waveform, apply a filterbank, log-compress, then DCT to get decorrelated cepstral coefficients. The difference is entirely in the filterbank - linearly spaced filters here instead of mel-warped ones - which preserves relatively more resolution at higher frequencies at the cost of the perceptual weighting MFCC applies. Everything downstream of that (the log compression, the DCT, the coefficient truncation) works the same way.

The inputs and outputs that matter

  • audio - the clip to analyze, required.
  • n_filter (default 128) - the number of linear filterbank filters, the LFCC equivalent of MFCC's n_mels. This is the intermediate filterbank resolution before the DCT compresses it down.
  • n_lfcc (default 40) - how many cepstral coefficients to keep after the DCT, the feature's actual output dimensionality. If you're matching an existing model or dataset's feature format, this needs to match exactly.
  • n_fft (default 1024) - FFT window size for the underlying STFT.
  • win_length and hop_length (optional, both default -1, though note hop_length's default here is actually 512 rather than the -1-derived value used elsewhere in the pack) - frame timing controls; leave alone unless you have a specific reason to match another tool's frame rate.
  • spec (output, SPEC) - the LFCC coefficients.

How to install it

ComfyUI Manager: search ComfyUI-speech-dataset-toolkit, install, restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/kale4eat/ComfyUI-speech-dataset-toolkit
cd ComfyUI-speech-dataset-toolkit
pip install torchaudio --index-url https://download.pytorch.org/whl/cu121
pip install -r requirements.txt

No extra dependencies - pure torchaudio signal processing.

Common issues & troubleshooting

Not sure whether to reach for this or SDT_MFCC. If you don't have a specific reason to prefer linear spacing, MFCC is the more generic, widely-supported default for general speech/speaker tasks. Reach for LFCC deliberately when the goal is detecting synthetic, manipulated, or vocoded speech, or when you're replicating a specific dataset/paper's feature pipeline that already specifies LFCC - matching that spec exactly (same n_filter, n_lfcc, n_fft) matters more here than for most features, since these numbers are usually locked to a published baseline.

Feature dimension mismatch against a reference implementation or pretrained model. Check n_lfcc first - it defines the output width, same role n_mfcc plays on the MFCC node. A close-but-not-exact match to a paper's stated dimensionality (e.g. 20 vs 40) is a common source of "works but gives worse results than the paper" confusion.

Can't reconstruct audio from this. Same as MFCC - it's a lossy, one-way feature, not something SDT_GriffinLim can turn back into a waveform. Use SDT_MelSpectrogram if you need something invertible.

This is a niche corner of a niche pack - outside the anti-spoofing research literature, LFCC doesn't come up much in general ComfyUI or speech-tooling discussion. If you're using it for that specific purpose, the ASVspoof-adjacent papers describing LFCC-based baselines are a far better reference for what "sensible" parameter choices look like than trial and error.

Categoryspeech-dataset-toolkit/spec

Inputs (6)

NameTypeDefaultDescription
audioAUDIO
n_filterINT1280–4294967296
n_lfccINT400–4294967296
n_fftINT10240–4294967296
win_lengthoptINT-1-1–4294967296
hop_lengthoptINT512-1–4294967296

Outputs (1)

NameTypeDescription
specSPEC