Nodes/ComfyUI-AudioMoodAnalyzer/Mood JSON Unpacker
ComfyUI Node

Mood JSON Unpacker

Mood JSON Unpacker Splits It Into Eight Strings

By andrea-spoldi·Created 4 months ago·Updated 3 months ago· 0
Mood JSON Unpacker
    • sonic_mood
    • energy_profile
    • tension_profile
    • color_palette
    • lighting_implications
    • texture_implications
    • composition_suggestions
    • avoid
    mood_json

    The Audio Mood Analyzer is generous with its outputs, but its most useful one - mood_json - is a single JSON blob. If you want to use the color palette in a positive prompt and the avoid list in a negative one, you're staring at a string you can't wire anywhere without a JSON parsing detour. Mood JSON Unpacker removes the detour: one input, eight STRING outputs, each one a field from the mood analysis. It's the smallest, most boring node in this pack, and it's the one you'll stop missing the moment you have it.

    This is pure plumbing, and that's the compliment. It takes the mood_json output from Audio Mood Analyzer and splits it into individual, wire-ready strings:

    • sonic_mood - comma-joined mood adjectives (e.g. melancholic, dense, pressured)
    • energy_profile - prose on energy level and behavior
    • tension_profile - prose on tension and internal pressure
    • color_palette - comma-joined color terms
    • lighting_implications - comma-joined lighting descriptors
    • texture_implications - comma-joined texture descriptors
    • composition_suggestions - comma-joined composition cues
    • avoid - comma-joined negative terms

    Every field where the mood analysis stored a list gets comma-joined for you; prose fields pass through as prose. Wire color_palette, lighting_implications, and texture_implications into CLIPTextEncode or a string concatenator, and wire avoid into your negative CLIPTextEncode. That last one is the sleeper feature - the mood analysis was already told to think about what not to generate, and here it is as a ready-made negative prompt.

    The two behaviors that make it safe to leave in the graph

    First, on malformed or empty input, every output returns "". Second, missing keys return "" individually. The node never raises - the source just does data[f] if f in data else "" for each field. Different Ollama models occasionally omit fields from the mood JSON (smaller models are the usual culprits), and this node turns that from a crash into a blank string on one output while the rest keep working. You can put it in a workflow, run it a hundred times, and never think about it again.

    Pairing it with the rest of the pack

    The natural workflow is Audio Mood Analyzer → Mood JSON Unpacker → CLIPTextEncode, with the avoid output feeding the negative encode. The pack's own example workflow (example_mood_unpack_enrich.json) shows exactly this alongside the Prompt Enricher, so you can see both approaches in one graph: unpack when you want the fields as separate wires, enrich when you want them appended to one prompt. Same source data, two philosophies.

    Install

    Nothing special - it ships in the ComfyUI-AudioMoodAnalyzer pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/andrea-spoldi/ComfyUI-AudioMoodAnalyzer.git
    pip install -r ComfyUI-AudioMoodAnalyzer/requirements.txt
    

    Restart ComfyUI and it appears under audio/mood. And since it's a pure string-splitter, it needs no Ollama and no model files of its own - just the mood_json you're already generating. If you're already running the analyzer, this node costs you nothing and quietly removes the fiddliest manual step in the whole pipeline.

    Categoryaudio/mood

    Inputs (1)

    NameTypeDefaultDescription
    mood_jsonSTRING

    Outputs (8)

    NameTypeDescription
    sonic_moodSTRING
    energy_profileSTRING
    tension_profileSTRING
    color_paletteSTRING
    lighting_implicationsSTRING
    texture_implicationsSTRING
    composition_suggestionsSTRING
    avoidSTRING