Nodes/Quality of Life Nodes for ComfyUI/JSON Chain Audio Array Pair (Soze)
ComfyUI Node

JSON Chain Audio Array Pair (Soze)

Audio batches, one MP3 per frame, as a JSON array

By SozeInc·Created 2 years ago·Updated 8 days ago· 10
JSON Chain Audio Array Pair (Soze)
  • audio
  • chain_in
  • chain_out
name
modedata_uri
save_path

A ComfyUI AUDIO batch can hold more than one clip, and when you need all of them in a payload - a set of voice samples, a sequence of TTS takes, clips to concatenate on the API side - the single JSON Chain Audio Pair only takes the first frame. JSON Chain Audio Array Pair (Soze) iterates the whole batch: one MP3-encoded entry per frame, bundled into a JSON array under your name.

It's the audio counterpart of the Image Array Pair, and it reuses the same encoding core, so the decisions are familiar: data_uri mode for self-contained payloads, filepath mode when you want tiny strings and don't mind files on disk. ComfyUI's AUDIO shape is [B, C, S] - batch × channels × samples - and this node walks the B dimension in order.

How it works

Each frame is encoded to MP3 (via torchaudio, which needs the ffmpeg backend - same dependency caveat as every node in the audio family) and appended to the array. In data_uri mode you get an array of data:audio/mpeg;base64,... strings. In filepath mode each frame is written out with a guaranteed-unique _NNNNN per-frame suffix so nothing overwrites, and you get an array of absolute paths. An empty batch yields an empty array rather than a crash.

Inputs and outputs

  • name - required string widget, the JSON key.
  • audio - required AUDIO input (forced). Every frame is encoded.
  • mode - data_uri or filepath.
  • save_path - filepath mode; each frame gets its own _NNNNN suffix.
  • chain_in - optional JSON_PAIRS.

Output: chain_out.

Installing it

Part of the Soze pack:

cd ComfyUI/custom_nodes
git clone https://github.com/SozeInc/ComfyUI_Soze.git
pip install -r ComfyUI_Soze/requirements.txt

Restart ComfyUI, or search ComfyUI_Soze in ComfyUI Manager.

Gotchas

The audio-family failures are all ffmpeg-shaped: if MP3 encoding fails, check torchaudio's backend before suspecting the node. And remember the output is an array, so if your downstream expects a single audio value you've grabbed the wrong variant. The decoder round-trip is supported: JSON Audio Decoder accepts this array format (plus newline lists and single values) and stacks everything back into one AUDIO batch, resampling mismatched sample rates to the first frame.

CategorySoze Nodes/JSON

Inputs (5)

NameTypeDefaultDescription
nameSTRING
audioAUDIO
modeCOMBOdata_uri2 options: data_uri, filepath
save_pathoptSTRINGfilepath mode: each frame gets its own _NNNNN suffix.
chain_inoptJSON_PAIRS

Outputs (1)

NameTypeDescription
chain_outJSON_PAIRS