Nodes/ComfyUI-PainterNodes/Painter Audio Mask
ComfyUI Node

Painter Audio Mask

The H3 're-dub one line' node that never actually touches your audio

By princepainter·Created 7 months ago·Updated 3 days ago· 192
Painter Audio Mask
    • mask
    mask_points[]
    duration10.0

    The name is a small lie: Painter Audio Mask takes no audio input. Its backend gets a few JSON points and a number, and what it hands you is a one-dimensional mask - but it's the exact shape of tool you want once you've generated a MiniMax H3 clip and the picture is great while one line of dialogue is botched.

    Here's the situation it exists for. MiniMax H3 is the 33B omni-modal model whose open-weight drop in August 2026 made video-with-native-audio a local thing: dialogue, sound effects and room tone come out of the sampler together with the picture. That's wonderful and it makes the "regenerate the whole thing because 3 seconds were wrong" workflow feel extra wasteful. You can't fix H3 audio with the 2D masks you're used to from image inpainting - the audio lives on its own track in the joint audio-video latent, and it's repaired along the time axis. That time-axis curve is what this node draws.

    How it works

    Look at the source and the whole backend is embarrassingly simple: parse a JSON array of control points [{t: seconds, v: 0..1}], linearly interpolate between them, and resample to round(duration × 40) frames. The 40 is not arbitrary - H3's audio latent runs at a fixed 40 frames per second, so the mask's time axis lines up with the latent's. The frontend does the actual work: it shows a waveform (upload an audio file purely as a visual guide - the backend never sees it), and you draw a curve over it.

    Two draw modes. Curve: click empty space to add a point, drag to move it, double-click to delete, Shift-drag to snap the value to 0 / 0.5 / 1. Block: drag a rectangle to stamp a flat value across a range. There's even a play button so you can audition while you draw.

    The value semantics match H3's audio_denoise_mask, and they're worth internalizing before you start clicking:

    • v = 0 → keep the original audio
    • v = 1 → fully regenerate that moment from your prompt
    • between 0 and 1 → partial blend, which is subtle

    The inputs that matter

    There are only two, and you'll barely touch either:

    • duration (FLOAT, default 10) - how long your audio segment is. Make it match the clip you're repairing.
    • mask_points (STRING, hidden) - the JSON control points. The drawing widget writes it for you; you should never type it by hand.

    Output is a single mask (MASK, shaped 1 × 1 × frames). That's where the real caveat lives: this pack's own repo doesn't show you the consumer. In an H3 partial-audio-regeneration workflow the mask plugs into whatever node applies a temporal denoise mask to the audio side of the AV latent on its way to the sampler - check how your particular H3 workflow accepts a MASK before assuming the socket exists. As a plain 1D time-mask generator it's also perfectly happy being read by other tooling.

    Installing it

    It ships inside the PainterNodes pack, so there's no separate install. In ComfyUI-Manager, search "PainterNodes" and install, or:

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

    Then restart ComfyUI. The requirements.txt is just soundfile and numpy - the heavy lifting is ComfyUI's core H3 support, which you need a recent build for, plus the H3 weights themselves. Mind the license: the H3 Community License doesn't permit running the open weights in the US, EU, UK or Korea. If you can't legally run H3, this node is a solution to a problem you don't have.

    Where people get burned

    • Length mismatch. The mask is resampled to duration × 40 no matter what. If your audio is 8 seconds and duration says 10, the curve won't line up with where the bad line actually is. Set duration to the real segment length.
    • The all-zeros no-op. No control points means an all-zero mask - keep everything. If you draw a curve and nothing regenerates, check you actually pushed it up to 1 where you wanted the rewrite.
    • Missing UI. The drawing canvas is a custom frontend extension. If you add the node and see only two collapsed widgets and no waveform area, the extension didn't load - restart ComfyUI. The node still technically runs, but drawing blind is not a good time.
    • Curve vs. block mode. Drag in Curve mode and you'll fight control points; in Block mode you'll stamp flat values. Pick Block for "this 2-second stretch is all wrong," Curve for fine shaping.
    Categoryaudio/mask

    Inputs (2)

    NameTypeDefaultDescription
    mask_pointsSTRING[]
    durationFLOAT10.00.1–1000

    Outputs (1)

    NameTypeDescription
    maskMASK