ComfyUI Node

Apply Filter Bank

The node that actually squeezes your spectrogram down to size

By rhdunn·Created 2 years ago·Updated 2 years ago· 13
Apply Filter Bank
  • spectrogram
  • fbank
  • SPECT

The filter-bank builders in this pack only describe a filter bank - a matrix of weights. Apply Filter Bank is the node that actually uses it: it takes your SPECT, multiplies it by the FILTER_BANK, and hands back a compressed spectrogram. It's the workhorse between "build the bank" and "look at the result," and it's where the pipeline stops being about raw FFT bins and starts being about bands.

How it works

The math is a single matrix multiply: the spectrogram (frequency × time) is transposed, multiplied against the filter-bank weight matrix, and transposed back. Each output row becomes a weighted sum of the FFT bins in that filter's band. The details are torchaudio's problem - your job is just to wire the two objects together.

Inputs are exactly two, both required:

  • spectrogram - a SPECT from the Spectrogram node.
  • fbank - a FILTER_BANK from Linear Filter Bank or Mel-scale Filter Bank.

The output is a SPECT again, with one crucial difference: its frequency axis is now n_filter (or n_mels) rows instead of n_fft/2 + 1 FFT bins. The spectrogram's stype carries through untouched - a complex spectrogram stays complex through the filter, a power one stays power - so you can filter and still know what you're looking at.

The trap: this SPECT is for analysis, not for going back to audio

Here's where people get bitten. The filtered SPECT keeps the original n_fft, win_length, and hop_length in its metadata - the node doesn't touch them - even though the actual frequency axis has been reduced to filter-bin count. If you then wire that into Inverse Spectrogram or Griffin Lim, the inverse runs with the original n_fft against a tensor that no longer has that many frequency bins. The shapes don't line up, and you get an error or, if you're unlucky, audio that's pure garbage.

So the mental model: Apply Filter Bank is the analysis/visualization branch. Wire its output into Plot Spectrogram to see the mel bands, or use it as features for whatever is doing the actual learning or matching. If you want audio out, filter the spectrogram for inspection but keep an unfiltered copy for the inverse path - the two branches of the graph serve different goals.

Why you'd use it at all

Honestly, if you're just eyeballing a spectrogram, the raw one is fine. Filter banks earn their keep when the downstream step cares about bands, not bins - mel features for a recognizer, band energies for audio-reactive work, a compact representation you're feeding into something that would choke on 201+ rows of near-redundant data. This node is the missing middle step that makes the bank builders useful instead of decorative.

Installing

Same one-liner as the whole pack - ComfyUI Manager search "comfyui-audio-processing", or:

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

Restart. No extra pip packages, no model downloads; it's pure torch tensor math.

Categoryaudio processing/filter bank

Inputs (2)

NameTypeDefaultDescription
spectrogramSPECT
fbankFILTER_BANK

Outputs (1)

NameTypeDescription
SPECTSPECT