Nodes/MD Nodes/MD: Latent Visualizer
ComfyUI Node

MD: Latent Visualizer

Stop debugging latents blind — see them as plots

By MDMAchine·Created about a year ago·Updated 3 months ago· 15
MD: Latent Visualizer
  • latent
  • latent_compare
  • image
modewaveform
channel0
batch_index0
normalizetrue
width512
height256
gridtrue
bg_color#0D0D1A
waveform_color#87CEEB
spectrum_color#FF00A2
rgb_r_color#FF3333
rgb_g_color#00FF8C
rgb_b_color#3399FF
axis_label_color#A0A0B0
grid_color#303040
all_modesfalse
log_scalefalse
show_statsfalse
detect_peaksfalse
peak_threshold0.50
line_stylesolid
line_alpha1.0
multi_channel_count3
colormapviridis

Latents are invisible. You can't preview a [B, C, H, W] tensor directly, so when something goes wrong mid-pipeline - a channel is dead, values are exploding, the "audio" latent is pure noise - you're debugging blind. ACE_LatentVisualizer exists to make latents visible: it takes a LATENT and renders it as one of nine plot types, so you can actually look at what's flowing through your graph instead of guessing. Despite the "ACE" name, it works on any standard ComfyUI latent, image or audio.

It's from the pack's latent/debugging corner (the class lives in the pack's latent/ module), and it's aimed squarely at the ACE-Step audio crowd who need to inspect latent structure - but image users get just as much value.

What it shows

The mode dropdown is the whole point. Nine modes, from practical to academic:

  • waveform - amplitude over the spatial dimension. The basic "is there a signal at all" check.
  • spectrum - FFT magnitude, for spotting frequency structure.
  • rgb_split - overlay the first three channels, for image latents.
  • heatmap - 2D spatial representation.
  • histogram - value distribution; this is how you spot a dead or exploding channel in one glance.
  • statistics - mean/std across channels.
  • multi_channel - render N channels at once.
  • phase - for audio latents.
  • difference - compare two latents; needs the optional latent_compare input (must match dimensions).

channel and batch_index pick which channel/sample you're looking at; normalize (default True) rescales to [0,1] so tiny signals are visible - at the cost of hiding true magnitude, as the tooltip warns.

The inputs that matter

  • mode, channel, batch_index - what and where to look.
  • width / height - output plot size (default 512×256).
  • show_stats - overlay mean/std/min/max on the plot; the tooltip recommends True for debugging.
  • all_modes - stack every applicable mode into one tall image. Slow, but a great "give me everything" view.
  • log_scale - dB scale for spectrum/histogram; the tooltip suggests it for audio analysis.
  • detect_peaks - marks local maxima (requires scipy in your Python env; it's not in the pack's requirements, so this is an opt-in extra).

The rest is cosmetics: background/line/grid colors, colormap, line style and opacity.

Where it fits

Wire it anywhere you want to inspect a latent - right after the sampler for a "what did denoising actually build" check, or mid-chain to compare before/after. The difference mode is the killer feature for the pack's ACE-Step audio workflows: pass the latent before and after a processing node and the difference plot shows exactly what changed.

Honest caveats: it's a debugging aid, not an analysis suite - for serious spectral work you'd still use the audio spectrum node on decoded audio. And the detect_peaks mode quietly requires scipy, which won't be there unless you installed it yourself. Otherwise it's a well-made "let me see the damn tensor" tool.

Installing

It's part of MD Nodes:

cd path/to/ComfyUI/custom_nodes
git clone https://github.com/MDMAchine/ComfyUI_MD_Nodes.git
cd ComfyUI_MD_Nodes && pip install -r requirements.txt

Or via ComfyUI Manager (search MD Nodes), then restart. matplotlib in the requirements is what renders these plots, so this node is part of the reason the pack's install is heavy.

CategoryMD_Nodes/Debugging & Visualization

Inputs (26)

NameTypeDefaultDescription
latentLATENTLATENT INPUT • Purpose: The latent tensor dictionary to visualize. • Accepts: Standard ComfyUI Latent format. • Output: Generates an image plot based on this data.
modeCOMBOwaveformVISUALIZATION MODE • Purpose: Select the type of analysis to perform. • Options: - waveform: Amplitude over spatial dimension. - spectrum: Frequency magnitude (FFT). - rgb_split: Overlay first 3 channels. - heatmap: 2D spatial representation. - histogram: Value distribution. - statistics: Mean/Std across channels. - difference: Compare two latents. ⭐ Recommended: 'waveform' for basic checks.
channelINT0CHANNEL INDEX • Purpose: Target specific latent channel for 1D modes. • Range: 0 to (Max Channels - 1). ⭐ Recommended: 0
batch_indexINT0BATCH INDEX • Purpose: Target specific image/audio in a batched latent. • Range: 0 to (Batch Size - 1). ⭐ Recommended: 0
normalizeBOOLEANtrueNORMALIZE SIGNAL • Purpose: Rescale amplitudes to [0, 1] range for easier viewing. • Trade-offs: Makes tiny signals visible, but hides true absolute magnitude. ⭐ Recommended: True
widthINT51264–2048PLOT WIDTH • Purpose: Output image width in pixels. • Range: 64 to 2048. ⭐ Recommended: 512
heightINT25664–2048PLOT HEIGHT • Purpose: Output image height in pixels. • Range: 64 to 2048. ⭐ Recommended: 256
gridBOOLEANtrueDISPLAY GRID • Purpose: Show background grid lines for visual reference. ⭐ Recommended: True
bg_colorSTRING#0D0D1ABACKGROUND COLOR • Valid Hex Code (e.g., #0D0D1A)
waveform_colorSTRING#87CEEBWAVEFORM COLOR • Valid Hex Code (e.g., #87CEEB)
spectrum_colorSTRING#FF00A2SPECTRUM COLOR • Valid Hex Code (e.g., #FF00A2)
rgb_r_colorSTRING#FF3333RED CHANNEL COLOR • Valid Hex Code
rgb_g_colorSTRING#00FF8CGREEN CHANNEL COLOR • Valid Hex Code
rgb_b_colorSTRING#3399FFBLUE CHANNEL COLOR • Valid Hex Code
axis_label_colorSTRING#A0A0B0AXIS LABEL COLOR • Valid Hex Code
grid_colorSTRING#303040GRID COLOR • Valid Hex Code
all_modesBOOLEANfalseRENDER ALL MODES • Purpose: Stacks all applicable visualization modes into one large image. • Trade-offs: Slower generation, very tall output image. ⭐ Recommended: False
log_scaleBOOLEANfalseLOGARITHMIC SCALE • Purpose: Use Log (dB) scale for Spectrum and Histogram Y-axis. ⭐ Recommended: False (unless analyzing audio)
show_statsBOOLEANfalseSHOW STATISTICS • Purpose: Overlay Mean, Std, Min, Max values on the plot. ⭐ Recommended: True for debugging
detect_peaksBOOLEANfalseDETECT PEAKS • Purpose: Marks local maxima on Waveform/Spectrum plots. • Requirement: Requires Scipy installed in python env. ⭐ Recommended: False
peak_thresholdFLOAT0.500–1PEAK THRESHOLD • Purpose: Minimum relative height (0-1) for a point to be considered a peak. ⭐ Recommended: 0.5
line_styleCOMBOsolidLINE STYLE • Purpose: Visual style of the plot lines.
line_alphaFLOAT1.00.1–1LINE OPACITY • Purpose: Transparency of the plot lines.
multi_channel_countINT31–16MULTI-CHANNEL COUNT • Purpose: Number of channels to render in 'multi_channel' mode.
colormapCOMBOviridisCOLORMAP • Purpose: Gradient used for Heatmap mode.
latent_compareoptLATENTLATENT COMPARE • Purpose: Second latent tensor required for 'difference' mode. • Requirement: Must match dimensions of primary latent.

Outputs (1)

NameTypeDescription
imageIMAGE