ComfyUI Node

Plot Spectrogram

Finally, look at the spectrogram you've been computing

By rhdunn·Created 2 years ago·Updated 2 years ago· 13
Plot Spectrogram
  • spectrogram
  • IMAGE
stypepower
titleSpectrogram
xlabelTime (s)
ylabelFrequency (Hz)
show_gridfalse

You computed a spectrogram. Now you want to see it. That's the entire job of Plot Spectrogram: it takes a SPECT and renders it with matplotlib into a plain IMAGE tensor, which means you can wire it into ComfyUI's Preview Image, save it with Save Image, or even feed the plot back into the graph as a regular image. It's the inspection node for the whole audio pipeline, and it's the one you'll reach for constantly while you're getting anything working.

How it works

Under the hood it's matplotlib's imshow with the frequency axis flipped so low frequencies sit at the bottom (the origin="lower" detail - the correct orientation for audio, not the computer-vision default). One subplot is drawn per audio channel, so a stereo file renders as two stacked spectrograms. The output IMAGE is a normal ComfyUI image tensor, float 0–1, ready for any image node.

The inputs that matter:

  • spectrogram - the SPECT you want to look at.
  • stype (default power) - what you want to display, which may differ from what you stored. A complex spectrogram is auto-converted to magnitude; a magnitude one is squared if you ask for power. So you can view any stored type as either magnitude or power without re-computing.
  • title, xlabel, ylabel - cosmetic labels, defaults "Spectrogram" / "Time (s)" / "Frequency (Hz)".
  • show_grid (default off) - gridlines, mostly decorative at this resolution.

The honest caveat

The axis labels are cosmetic. The plot is rendered with raw pixel indices - the x axis is frame index, not seconds, and the y axis is frequency bin, not Hz. The defaults say "Time (s)" and "Frequency (Hz)" but there's no calibration behind them. For most purposes that's fine - a spectrogram's shape is what you're judging - but if you need a true-to-scale plot, this node isn't it. Know what you're looking at and the labels won't mislead you.

Where it shines is the filter-bank pipeline: Apply Filter Bank the mel version and plot it here to actually see the compressed bands. The node handles filtered spectrograms fine because it never assumes the original bin count - it just renders whatever rows the SPECT has.

Installing

One-liner like 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. It depends on matplotlib, which is already a ComfyUI dependency, so there's nothing extra to install and no models to download.

Categoryaudio processing/spectrogram

Inputs (6)

NameTypeDefaultDescription
spectrogramSPECT
stypeoptCOMBOpower2 options: magnitude, power
titleoptSTRINGSpectrogram
xlabeloptSTRINGTime (s)
ylabeloptSTRINGFrequency (Hz)
show_gridoptBOOLEANfalse

Outputs (1)

NameTypeDescription
IMAGEIMAGE