ComfyUI Node

Plot Spectrogram

Render an already-computed SPEC into a viewable image

By kale4eat·Created 2 years ago·Updated about a year ago· 23
Plot Spectrogram
  • spec
  • graph_image
titleSpectrogram (db)
ylabelfreq_bin

The other half of the two-step spectrogram path. SDT_Spectrogram or SDT_MelSpectrogram computes the actual frequency-over-time data and hands it back as the pack's generic SPEC type; this node takes that and draws it as a proper dB-scaled image. If you're already computing a SPEC for some other reason - feeding a model, comparing representations - this is how you also get to look at it, without recomputing anything.

How it works

SPEC is a generic 2D array of frequency bins over time, and this node doesn't care whether it came from a linear STFT (SDT_Spectrogram) or a mel-warped one (SDT_MelSpectrogram) - both share the same output type, so both plug into this node interchangeably. It renders the array as a color-mapped image, with the title default "Spectrogram (db)" signaling it expects decibel-scaled magnitude data, which is what both of those upstream nodes produce.

The inputs and outputs that matter

  • spec (SPEC, required) - from SDT_Spectrogram or SDT_MelSpectrogram. It will not accept a plain AUDIO clip directly - that's what SDT_PlotSpecgram is for.
  • title (default "Spectrogram (db)") - cosmetic label.
  • ylabel (default "freq_bin") - the y-axis label. Worth changing to something like "mel_bin" when you're plotting a mel spectrogram's output, since this node has no way to know which kind of SPEC it was handed and won't relabel the axis for you automatically.
  • graph_image (output, IMAGE) - the rendered plot.

How to install it

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

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 beyond the pack baseline.

Common issues & troubleshooting

Type error wiring audio straight in. This node wants a SPEC, not AUDIO. You need SDT_Spectrogram or SDT_MelSpectrogram in between first - or use SDT_PlotSpecgram instead if you just want a one-step audio-to-image shortcut and don't need the intermediate data for anything else.

Axis label says "freq_bin" but you plotted a mel spectrogram. That's a cosmetic mismatch only - the underlying data is unaffected. Set ylabel to something like "mel_bin" by hand for accuracy; the node can't infer it.

Image looks washed out or nearly all one color. Usually means the magnitude range in the source SPEC is degenerate - a near-silent or very short clip, for instance. Check the source audio with SDT_PlotWaveForm before assuming the plotting is at fault.

Not sure why this pack splits computing a spectrogram from plotting one, when SDT_PlotSpecgram does both in a single node. The split exists for reuse - a SPEC you compute once can be plotted here for a sanity check and fed into a model or another comparison downstream, whereas SDT_PlotSpecgram's output is only ever a picture. If you're building anything more involved than a one-off look at a clip, the two-step path is usually the better habit to build even when it feels like more clicks.

Categoryspeech-dataset-toolkit/visualize

Inputs (3)

NameTypeDefaultDescription
specSPEC
titleSTRINGSpectrogram (db)
ylabelSTRINGfreq_bin

Outputs (1)

NameTypeDescription
graph_imageIMAGE