Mel-scale Filter Bank
The spectrogram compression that actually matches human hearing
- spectrogram
- FILTER_BANK
When someone says "mel spectrogram" - in a speech-to-text paper, a TTS demo, a music-gen model - this is the operation they mean. Mel-scale Filter Bank builds the triangular filter bank that squashes a full-resolution spectrogram down to a compact representation tuned to how your ears actually work. If you use exactly one filter-bank node from this pack, make it this one.
How it works
It wraps torchaudio's melscale_fbanks, and it's the log-spaced cousin of the pack's Linear Filter Bank. Instead of spreading filters evenly across frequency, it spaces them on the mel scale - dense at low frequencies, sparse at high ones, mirroring human perception where we hear subtle pitch differences at 200 Hz and almost none at 8 kHz. Feed it a SPECT (it reads sample rate and n_fft from the metadata) and you get back a FILTER_BANK object ready for Apply Filter Bank or Plot Filter Bank.
The three inputs are the same shape as the linear version:
f_min(default 0) andf_max(default 44100) - the frequency window the mel filters span.n_mels(default 128) - the number of mel bands. 128 is the classic choice you'll see in virtually every paper; 40–80 is common for leaner front-ends.
Two things to set before you run
The first is the Nyquist trap, shared with the linear bank: f_max defaults to 44100, so on 48 kHz audio it's already fine (Nyquist is 24 kHz), but if you push f_max past Nyquist, torchaudio warns and clamps - no crash, just silently collapsed top filters. Keep f_max ≤ sample_rate/2 and you're safe.
The second is subtler and worth knowing if you've ever stared at a mel spectrogram wondering why the top rows look empty: mel resolution is so coarse up high that with n_mels=128 on a 400-bin n_fft, most of your mel bands are dense at the bottom and barely anything at the top. That's not a bug, it's the whole design. If you're generating or analyzing content with important high-frequency detail (cymbals, sibilance), either raise n_fft on the upstream Spectrogram node or accept the mel's low-frequency bias.
Where it sits in a workflow
The FILTER_BANK output only does two things: get applied (Apply Filter Bank) and get plotted (Plot Filter Bank). The applied result is a compressed SPECT - great for analysis, feature extraction, or as the input to anything downstream that wants mel features. Don't expect to invert it back to audio; that path is for the untouched spectrogram. Think of the filter-bank chain as the analysis branch of your graph.
Installing
ComfyUI Manager search "comfyui-audio-processing", or:
cd ComfyUI/custom_nodes
git clone https://github.com/rhdunn/comfyui-audio-processing
Restart. No requirements.txt to run, no models to download - torchaudio and friends are already in ComfyUI, which is the whole reason this pack installs in one step.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| spectrogram | SPECT | — | |
| f_minopt | FLOAT | 00–96000 | — |
| f_maxopt | FLOAT | 441000–96000 | — |
| n_melsopt | INT | 1281–4294967296 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| FILTER_BANK | FILTER_BANK | — |