Nodes/comfyui-audio-processing/Linear Filter Bank
ComfyUI Node

Linear Filter Bank

Evenly-spaced triangular filters, and why you'd bother

By rhdunn·Created 2 years ago·Updated 2 years ago· 13
Linear Filter Bank
  • spectrogram
  • FILTER_BANK
f_min0
f_max44100
n_filter128

A raw spectrogram has a lot of bins - with the pack's default n_fft of 400 you get 201 of them, and most carry information you don't need. A filter bank compresses that frequency axis down to a handful of smoothed bands. Linear Filter Bank builds the simplest version of that: a set of triangular filters spaced evenly across the frequency range, exactly like the classic filter bank at the front of every old-school speech and audio pipeline.

How it works

The node calls torchaudio's linear_fbanks function. You feed it a SPECT - it reads the sample rate and n_fft straight out of the spectrogram's metadata, so you don't configure the frequency axis yourself. The three optional inputs shape the bank:

  • f_min (default 0) and f_max (default 44100) - the frequency range the filters spread across.
  • n_filter (default 128) - how many triangular filters you want. Each triangle overlaps its neighbors, so 128 filters turn 201 FFT bins into 128 smoothed bands.

The output is a FILTER_BANK object - a matrix of filter weights plus its metadata - which you hand to Apply Filter Bank to actually apply, or to Plot Filter Bank to look at.

The gotcha hiding in the default

f_max defaults to 44100, which assumes your audio is 44.1 kHz. Feed it 48 kHz audio and set f_max above the Nyquist frequency (24 kHz for 48 kHz audio) and torchaudio warns you - it clamps the bank to Nyquist, so your top filters silently collapse. It won't crash, but the output won't be what you asked for. Rule of thumb: keep f_max at or below sample_rate / 2. The Spectrogram node's metadata carries the sample rate, so check that before you set f_max to something fancy.

Why linear, though

Honestly? You usually don't want linear. Human hearing is roughly logarithmic - we resolve fine detail at low frequencies and barely distinguish high ones - which is why the mel scale (this pack's Mel-scale Filter Bank) exists and why every speech-recognition and vocoder front-end uses it. Linear banks keep uniform frequency resolution, which matters when you're doing analysis where every Hz counts equally, or when you're deliberately modeling something that isn't human hearing. If you just want "a compact spectrogram," pick the mel version. If you want uniform resolution or a stepping stone to understanding the mel version, start here.

Installing

Same as the rest of the pack - ComfyUI Manager search "comfyui-audio-processing", or:

cd ComfyUI/custom_nodes
git clone https://github.com/rhdunn/comfyui-audio-processing

Restart, no extra dependencies, no model downloads. torchaudio handles all the heavy lifting and it's already in ComfyUI.

Categoryaudio processing/filter bank

Inputs (4)

NameTypeDefaultDescription
spectrogramSPECT
f_minoptFLOAT00–96000
f_maxoptFLOAT441000–96000
n_filteroptINT1281–4294967296

Outputs (1)

NameTypeDescription
FILTER_BANKFILTER_BANK