Nodes/ComfyUI-MusicGen-HF/Audio Output to Conditioning Queue
ComfyUI Node

Audio Output to Conditioning Queue

Chain generations — feed the last track back in for a continuation

By ebrinz·Created about a year ago·Updated 10 months ago· 11
Audio Output to Conditioning Queue
  • audio_input
  • conditioning_audio
  • queue_info
  • loaded_file
queue_idmain_chain
source_modelast_generated
max_conditioning_duration10.0
file_path

Here's the thing that makes this pack feel like a real music tool instead of a one-shot generator: AudioOutputToConditioningQueue lets you take audio you already generated and feed it back into HuggingFaceMusicGen's conditioning_audio input, so the next generation continues the previous one. One prompt becomes a progression. A two-bar loop becomes a full track, stitched generation by generation.

Displayed as "Audio Output to Conditioning Queue", it's the connective tissue between runs. You run MusicGen, it stores its output, this node retrieves it, hands it back as conditioning audio, and the next generation extends it.

How it works

There's a bit of plumbing under the hood that's actually clever. The HuggingFaceMusicGen node automatically stores every generation it produces into a class-level store under the queue id main_chain - no extra wiring needed. This node then grabs that stored audio (or loads from a file, or takes a direct socket input) and trims it to your max_conditioning_duration, so you're not conditioning on an arbitrarily long history. It also keeps a queue of up to 10 previous entries per queue_id, so a longer continuation chain is possible.

The inputs that matter:

  • queue_id - default main_chain. This must match how you run your MusicGen node, because that's the key the generated audio is stored under. Keep the default and it just works.
  • source_mode - last_generated (default, grabs the most recent MusicGen output), load_file (reads from file_path, resolving relative paths against ComfyUI's output then input directories), or direct_input (uses the audio_input socket you connect).
  • max_conditioning_duration - 1–30s, default 10. Cap on how much history feeds the next generation. Lower = faster, more focused continuations.
  • file_path - only for load_file mode.

Outputs: conditioning_audio (AUDIO, the thing you wire into MusicGen), queue_info (STRING, queue length and what got loaded), and loaded_file (STRING, the filename or source used).

Where it fits

HuggingFaceMusicGen → audio ──┐
                              ↓
                AudioOutputToConditioningQueue
                              ↓ conditioning_audio
                    HuggingFaceMusicGen (next)

A classic continuation chain: generate part one, let this node catch the output, generate part two with part one as conditioning, repeat. Or in load_file mode, point it at a saved track and have MusicGen extend something you made yesterday.

Install

Same pack, same drill - ebrinz/ComfyUI-MusicGen-HF via Manager (search the pack title) or:

cd ComfyUI/custom_nodes
git clone https://github.com/ebrinz/ComfyUI-MusicGen-HF
cd ComfyUI-MusicGen-HF
pip install -r requirements.txt

Restart ComfyUI.

Troubleshooting

The most common failure is silence in the output plus a queue_info that says "No last generated audio available" - that means MusicGen hasn't run yet in this ComfyUI session, or it stored under a different queue_id than you're reading. Run the generation node first, keep queue ids consistent, and you're fine. If load_file says "File not found", remember relative paths resolve against output/input dirs - an absolute path always wins. And don't use direct_input mode without connecting audio_input; it returns a silence stub with an error string. When in doubt, read the queue_info output - it's honest about what happened.

Categoryaudio/musicgen

Inputs (5)

NameTypeDefaultDescription
queue_idSTRINGmain_chainUnique identifier for this conditioning chain
source_modeCOMBOlast_generatedSource of conditioning audio
max_conditioning_durationFLOAT10.01–30Maximum duration for conditioning audio
audio_inputoptAUDIODirect audio input (for direct_input mode)
file_pathoptSTRINGPath to audio file (for load_file mode)

Outputs (3)

NameTypeDescription
conditioning_audioAUDIO
queue_infoSTRING
loaded_fileSTRING