MD: Latent Visualizer
Stop debugging latents blind — see them as plots
- latent
- latent_compare
- image
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 optionallatent_compareinput (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.
Inputs (26)
| Name | Type | Default | Description |
|---|---|---|---|
| latent | LATENT | LATENT INPUT • Purpose: The latent tensor dictionary to visualize. • Accepts: Standard ComfyUI Latent format. • Output: Generates an image plot based on this data. | |
| mode | COMBO | waveform | VISUALIZATION 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. |
| channel | INT | 0 | CHANNEL INDEX • Purpose: Target specific latent channel for 1D modes. • Range: 0 to (Max Channels - 1). ⭐ Recommended: 0 |
| batch_index | INT | 0 | BATCH INDEX • Purpose: Target specific image/audio in a batched latent. • Range: 0 to (Batch Size - 1). ⭐ Recommended: 0 |
| normalize | BOOLEAN | true | NORMALIZE SIGNAL • Purpose: Rescale amplitudes to [0, 1] range for easier viewing. • Trade-offs: Makes tiny signals visible, but hides true absolute magnitude. ⭐ Recommended: True |
| width | INT | 51264–2048 | PLOT WIDTH • Purpose: Output image width in pixels. • Range: 64 to 2048. ⭐ Recommended: 512 |
| height | INT | 25664–2048 | PLOT HEIGHT • Purpose: Output image height in pixels. • Range: 64 to 2048. ⭐ Recommended: 256 |
| grid | BOOLEAN | true | DISPLAY GRID • Purpose: Show background grid lines for visual reference. ⭐ Recommended: True |
| bg_color | STRING | #0D0D1A | BACKGROUND COLOR • Valid Hex Code (e.g., #0D0D1A) |
| waveform_color | STRING | #87CEEB | WAVEFORM COLOR • Valid Hex Code (e.g., #87CEEB) |
| spectrum_color | STRING | #FF00A2 | SPECTRUM COLOR • Valid Hex Code (e.g., #FF00A2) |
| rgb_r_color | STRING | #FF3333 | RED CHANNEL COLOR • Valid Hex Code |
| rgb_g_color | STRING | #00FF8C | GREEN CHANNEL COLOR • Valid Hex Code |
| rgb_b_color | STRING | #3399FF | BLUE CHANNEL COLOR • Valid Hex Code |
| axis_label_color | STRING | #A0A0B0 | AXIS LABEL COLOR • Valid Hex Code |
| grid_color | STRING | #303040 | GRID COLOR • Valid Hex Code |
| all_modes | BOOLEAN | false | RENDER ALL MODES • Purpose: Stacks all applicable visualization modes into one large image. • Trade-offs: Slower generation, very tall output image. ⭐ Recommended: False |
| log_scale | BOOLEAN | false | LOGARITHMIC SCALE • Purpose: Use Log (dB) scale for Spectrum and Histogram Y-axis. ⭐ Recommended: False (unless analyzing audio) |
| show_stats | BOOLEAN | false | SHOW STATISTICS • Purpose: Overlay Mean, Std, Min, Max values on the plot. ⭐ Recommended: True for debugging |
| detect_peaks | BOOLEAN | false | DETECT PEAKS • Purpose: Marks local maxima on Waveform/Spectrum plots. • Requirement: Requires Scipy installed in python env. ⭐ Recommended: False |
| peak_threshold | FLOAT | 0.500–1 | PEAK THRESHOLD • Purpose: Minimum relative height (0-1) for a point to be considered a peak. ⭐ Recommended: 0.5 |
| line_style | COMBO | solid | LINE STYLE • Purpose: Visual style of the plot lines. |
| line_alpha | FLOAT | 1.00.1–1 | LINE OPACITY • Purpose: Transparency of the plot lines. |
| multi_channel_count | INT | 31–16 | MULTI-CHANNEL COUNT • Purpose: Number of channels to render in 'multi_channel' mode. |
| colormap | COMBO | viridis | COLORMAP • Purpose: Gradient used for Heatmap mode. |
| latent_compareopt | LATENT | LATENT COMPARE • Purpose: Second latent tensor required for 'difference' mode. • Requirement: Must match dimensions of primary latent. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |