Nodes/ComfyUI-MiniMax-Music-Production-Toolkit/Parse Structured Music LLM Output
ComfyUI Node

Parse Structured Music LLM Output

Turning an LLM's rambling reply into four clean song fields

By jplenio·Created about 16 hours ago·Updated about 15 hours ago· 0
Parse Structured Music LLM Output
    • caption
    • lyrics
    • title
    • image_prompt
    • source_name
    • generation_seed
    • run_index
    • variant_count
    • source_path
    • prompt_origin
    • prompt_provenance_json
    structured_llm_output
    song_count1
    seed_moderandom_each_song
    base_seed1
    user_promptInstrumental Progressive House with melodic and subtle trance influences, highly atmospheric and spacious, driven by memorable signature motifs and distinctive recurring synth riffs. Emotional, smooth, modern, with strong progression and evolving layers. create a 4–5 minutes long melodic story in the track.
    source_name_override
    fallback_titlellm-song

    Anyone who's wired a chat LLM into a generation graph knows the pain: the model gives you exactly what you asked for, wrapped in "Here is your enhanced prompt!" and a closing paragraph, and you have to scrape the good parts out of the chat-shaped noise. That's failure mode one from the local-LLM playbook, and it's exactly what this node exists to kill. Parse Structured Music LLM Output takes the assistant's text, extracts the [Caption], [Lyrics], [Title], and [Image_Prompt] sections, validates that the required music sections are present, and emits each one as a clean STRING - plus per-song seeds and provenance.

    The bundled system prompt demands the canonical [Caption] → [Lyrics] → [Title] → [Image_Prompt] order, but the parser is deliberately order-tolerant: an LLM that shuffles the sections won't nuke an otherwise usable result. What it won't tolerate is missing or empty required sections - it raises an error rather than silently generating a song with no caption. Silent failure is worse than a loud one here.

    Inputs

    • structured_llm_output - the full assistant text from your LLM node.
    • song_count - how many song variants to emit from this source (1–100). More songs = more downstream generation time, obviously.
    • seed_mode - random_each_song (fresh seed per variant) or increment_from_base (reproducible sequential seeds from base_seed). For reproducible batches, increment is the one you want.
    • base_seed - only meaningful in increment mode.
    • user_prompt - stored with the parsed result for provenance.
    • source_name_override - replaces the auto-derived source identifier when non-empty.
    • fallback_title - used only when no usable [Title] survives parsing; it never replaces a valid LLM title.

    Outputs

    Every output is a list (is_list), so ComfyUI maps them across your batch: caption, lyrics, title, image_prompt, source_name, generation_seed, run_index, variant_count, source_path, prompt_origin, and prompt_provenance_json. Wire caption + lyrics into the MiniMax Music 3 node, image_prompt into the artwork branch, and the provenance outputs into MiniMax Song Metadata.

    Installing it

    Pack install via ComfyUI Manager (search "MiniMax Music Production Toolkit") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/jplenio/ComfyUI-MiniMax-Music-Production-Toolkit.git
    cd ComfyUI-MiniMax-Music-Production-Toolkit
    python -m pip install -r requirements.txt
    

    Dependencies: scipy, soundfile, imageio-ffmpeg, mutagen, Pillow. Restart ComfyUI and hard-refresh once.

    Gotchas

    If you get a hard parse error, the LLM probably skipped a required section or mangled the tags - the README's honest caveat applies: "the example LLM stage depends on the quality and instruction-following ability of the GGUF model you choose." A small or heavily-quantized model that truncates its output mid-[Lyrics] will trip this node on purpose. And the cache-buster rule applies upstream: if the LLM output looks identical every run, the LLM node is caching - wire in the LLM Session ID node, not the parser.

    CategoryMiniMax Music Production Toolkit/prompts

    Inputs (7)

    NameTypeDefaultDescription
    structured_llm_outputSTRINGComplete assistant text returned by the external LLM. The bundled production prompt requires the order [Caption], [Lyrics], [Title], [Image_Prompt]. The parser remains order-tolerant but malformed or empty required sections raise an error instead of silently generating with missing fields.
    song_countINT11–100Number of song variants to emit from the selected source. Higher values repeat the downstream workflow for additional variants and therefore increase total generation time.
    seed_modeCOMBOrandom_each_songControls how generation seeds are created for multiple songs. random_each_song chooses a fresh seed per item; increment_from_base produces reproducible sequential seeds starting from base_seed.
    base_seedINT10–9223372036854776000Base integer used when deterministic/incrementing seed generation is selected. With random_each_song it is not the source of the random values; with increment_from_base each variant is derived from this value.
    user_promptSTRINGInstrumental Progressive House with melodic and subtle trance influences, highly atmospheric and spacious, driven by memorable signature motifs and distinctive recurring synth riffs. Emotional, smooth, modern, with strong progression and evolving layers. create a 4–5 minutes long melodic story in the track.Short user/music request sent to the external LLM or stored with the parsed result. This is the concise creative request that the long system prompt expands into MiniMax fields.
    source_name_overrideSTRINGOptional explicit source name. When non-empty it replaces the automatically derived source identifier used for filenames/provenance.
    fallback_titleSTRINGllm-songTitle used only when a usable [Title] cannot be extracted. It does not replace valid LLM-generated titles.

    Outputs (11)

    NameTypeDescription
    captionSTRING
    lyricsSTRING
    titleSTRING
    image_promptSTRING
    source_nameSTRING
    generation_seedINT
    run_indexINT
    variant_countINT
    source_pathSTRING
    prompt_originSTRING
    prompt_provenance_jsonSTRING