Nodes/ComfyUI ARG Toolkit/Spectrogram to Audio
ComfyUI Node

Spectrogram to Audio

Got a Hidden Audio File in a Picture? This Node Digs It Back Out

By AzelusLightvale·Created 12 months ago·Updated 3 days ago· 1
Spectrogram to Audio
  • image
  • audio
channelluminance
window_size25.0000
hop_size15.000
windowing_funcHanning
scaling_methodLogarithmic
autogain
top_db80.00
sampling_rate44100
max_iter32
gl_momentum0.99
colormap_low#000000
colormap_mid#B73779
colormap_high#FCFDBF
max_amp1.0
mel_scalefalse

That weird rainbow-striped PNG in an ARG puzzle, the "album art" that's way too regular to be real, the image someone told you to "listen to" - that's a spectrogram, a picture of audio. The SpectrogramDecoder node (displayed as Spectrogram to Audio) is what pulls the sound back out, entirely inside ComfyUI. It's the receive half of the ComfyUI ARG Toolkit's audio story, paired with the pack's SpectrogramEncoder (Audio to Spectrogram): encode a message into a picture, post the picture somewhere, and anyone with this node can render it back into a waveform and hear what you actually said.

A word up front so you don't get surprised later: this is pure DSP, no ML model involved. There are no checkpoints to download, no VRAM cost, nothing to fetch. It's a handful of well-trodden signal-processing routines wired into a node, which is exactly what you want in a steganography toolkit - it makes the hidden payload deterministic and recoverable, instead of a coin flip through a neural net.

How it works

Peek at the source and the pipeline is clear. The node flips the image vertically, then collapses it from three color channels down to a per-frame magnitude profile. If you set channel to colormap it projects each pixel onto the low/mid/high color gradient you define (those colormap_low/colormap_mid/colormap_high hex strings) to recover the exact value the encoder mapped in. Otherwise it takes luminance (proper ITU-R BT.601 weighted brightness) or a single RGB channel.

Then the numbers get scaled back to linear amplitude - for the Logarithmic methods it inverts the dB scale (10^(norm*top_db - top_db)/20); for Linear/Quadratic it peak-normalizes, either automatically (autogain) or against your max_amp. And finally Griffin-Lim - a classic phase-reconstruction algorithm - turns that magnitude profile into an actual waveform. The output is a standard ComfyUI AUDIO dict, so it wires straight into any audio-save or preview node.

The inputs that matter

For a beginner, honestly, there are four:

  • image - the spectrogram image you're decoding.
  • scaling_method - must match whatever was used to make the image. The default Logarithmic is the common one; pick Logarithmic Mel if you see a warped (mel) spectrogram, Linear/Quadratic for un-logged ones. This is the field that silently ruins your decode if you guess wrong.
  • window_size / hop_size - frame size and overlap in milliseconds (defaults 25 / 15). Same rule: these have to match the encoder. This is the classic ARG pain point - when you're handed someone else's spectrogram image you don't know their parameters, so decoding becomes trial and error.
  • max_iter - Griffin-Lim iterations (default 32). More = cleaner phase reconstruction, but slower.

Also worth knowing: channel defaults to luminance, but if the image was made with a known colormap, switch to colormap for a much cleaner recovery. sampling_rate (default 44100) sets the output rate; the optional mel_scale toggle picks HTK vs Slaney mel scaling. gl_momentum at 0.99 enables Fast Griffin-Lim - set it to 0 to disable.

Installing it

Through ComfyUI Manager, search "ComfyUI ARG Toolkit" and install. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/AzelusLightvale/ComfyUI-ARG-Toolkit

Then restart ComfyUI. The pack needs torchaudio for this node (plus torch and numpy for the rest of the toolkit) - ComfyUI Manager handles that, and if you get a ModuleNotFoundError for torchaudio when running the node, pip install torchaudio in your ComfyUI environment fixes it. No model files, no API keys.

Common gotchas

The big one is parameter mismatch: decode with different window_size/hop_size/scaling_method than the encoder used and you get noise, not a voice. Pair this node with its own encoder when you control both ends, and write your settings down for the other side.

The other thing to set expectations on: Griffin-Lim only reconstructs magnitude - phase is estimated, not recovered. Output from a decoded spectrogram is inherently a bit lo-fi and phasey, especially for speech. That's the algorithm, not a bug in this node; crank max_iter if you need better quality. Also note this is an amateur-maintained pack (the author says so themselves - tests are manual, not automated), so it's a fun ARG tool, not production audio infrastructure.

CategoryARG Toolkit/Steganography/Analysis

Inputs (16)

NameTypeDefaultDescription
imageIMAGEThe spectrogram image to decode into audio.
channelCOMBOluminanceThe color channel used to collapse and deconstruct the image. For spectrograms with a known colormap, use `colormap`, otherwise use `luminance` or any of the RGB channels.
window_sizeFLOAT25.00000.001–100000The size of each 'frame' in miliseconds.
hop_sizeFLOAT15.0000.001–100000The size of the overlap between each 'frames' in miliseconds
windowing_funcCOMBOHanningThe windowing function to use. Unless you know what you're doing, leave this as default.
scaling_methodCOMBOLogarithmicThe scaling method used for the spectrogram.
autogainBOOLEANFor Linear and Quadratic scaling method, dynamically scale the amplitude based on the peak. If disabled, use `max_amp` to define it instead. If used with Logarithmic Mel scaling, will enable area normalization if used with `mel_scale=slaney`.
top_dbFLOAT80.000–255The dynamic range (in negative dB) to scale against for both Logarithmic scaling methods.
sampling_rateINT44100100–384000The target sample rate for the audio file.
max_iterINT321–1024Maximum iteration to run the Griffin-Lim algorithm for.
gl_momentumFLOAT0.990–2For use with Fast Griffin-Lim. 0 disables Fast Griffin-Lim.
colormap_lowoptSTRING#000000The color of the lowest point of the spectrogram.
colormap_midoptSTRING#B73779The color of the middle point of the spectrogram.
colormap_highoptSTRING#FCFDBFThe color of the highest point of the spectrogram.
max_ampoptFLOAT1.00–1If `autogain is disabled, this defines the maximum amplitude to scale with in Linear and Quadratic scaling.
mel_scaleoptBOOLEANfalseMel scaling method to use.

Outputs (1)

NameTypeDescription
audioAUDIO