Nodes/MaskVidExperiments/MVEx Audio Mask To Latent
ComfyUI Node

MVEx Audio Mask To Latent

Regenerate Just Part of the Audio in an AV Latent (Set Latent Noise Mask Can't)

By drozbay·Created 28 days ago·Updated 8 days ago· 126
MVEx Audio Mask To Latent
  • latent
  • vae
  • mask
  • LATENT
timing
start_time0.00
end_time1.00
existing_maskkeep
time_ranges

The video side of joint audio-video models like LTX-2 and MiniMax H3 got proper masked inpainting in ComfyUI. The audio side didn't - Set Latent Noise Mask can't reach into the audio stream of a joint latent at all. So if you want to regenerate, say, only the dialogue section of a clip and keep the rest of the audio intact, the stock nodes have no answer. MVEx Audio Mask To Latent is the audio counterpart of Mask To Latent Space: it attaches an audio noise mask to the latent itself, marking the time ranges that regenerate and the ranges that stay.

That last bit is the mechanism worth understanding. The node writes the mask directly onto the latent's noise_mask - as a nested mask for a joint AV latent, or a plain audio mask for a bare audio latent - because that's the only place the sampler will see it. It also merges with any mask already on the latent, so chains of this node accumulate ranges instead of clobbering each other.

How you pick the ranges

Three ways, in priority order:

  1. time_ranges - comma-separated seconds as in,out pairs: 0,1.5,3,4.25. Takes priority over everything.
  2. mask - a mask over the audio timeline, time along the width axis stretched to the audio duration. White = regenerate, black = keep. Handy when your ranges come out of some other node as an image.
  3. start_time / end_time - a single range in seconds. Only used when neither of the above is set.

The other inputs that matter

  • latent - a joint AV latent (MiniMax H3, LTX-2) or an audio latent alone.
  • timing - auto reads the audio latent rate and layout from the connected audio VAE; manual lets you type them (latents per second: 40 for H3, 25 for LTX; layout "time last" vs "time then bins" for LTX spectrogram latents). Auto is the path of least resistance.
  • vae - required when timing is auto. Important detail: for a joint AV latent it's the audio VAE, not the video one. Connecting the wrong VAE is the most common setup error.
  • existing_mask (default "keep") - merge new ranges into the audio mask already on the latent (so copies of the node chain), or discard it first. Either way the video side of a joint mask is kept.

Output is the latent with the audio noise mask attached, ready for the sampler.

The video-side gotcha that trips everyone

Here's the subtle part, straight from the node description: on a joint latent without an existing noise mask, the video is fully preserved - the node only touches the audio side. If you also want the video to regenerate during those same ranges, apply Set Latent Noise Mask before this node so the video side of the mask exists; the audio node then keeps it. Get the order wrong and you'll wonder why your "regenerate" pass changed the sound but froze the picture, or vice versa.

If a range isn't regenerating (or the wrong range is), the first check is timing. A wrong latents-per-second shifts your seconds into the wrong latent frames, so 0,1.5 lands on the wrong audio. That's also what makes the pack's companion debug node worth having.

Install

Part of MaskVidExperiments, from drozbay (RES4LYF maintainer, Wan VACE tooling). ComfyUI Manager, search "MaskVidExperiments", or:

cd ComfyUI/custom_nodes
git clone https://github.com/drozbay/MaskVidExperiments

restart. No model files, no dependencies beyond ComfyUI's own, needs v0.15.0+. This is a niche tool - audio-side masking of joint latents is a corner of a corner - but for lipsync cleanup or swapping one line of dialogue without regenerating the whole track, it's the only clean answer in the ecosystem right now.

CategoryMaskVidExperiments

Inputs (8)

NameTypeDefaultDescription
latentLATENTJoint AV latent or audio latent to mask.
timingCOMBOauto: read the audio latent rate and layout from the connected audio VAE. manual: enter them directly.
start_timeFLOAT0.000–10000Start of the regenerated audio range in seconds. Ignored when time_ranges or mask is used.
end_timeFLOAT1.000–10000End of the regenerated audio range in seconds. Ignored when time_ranges or mask is used.
existing_maskCOMBOkeepkeep: merge the new ranges into the audio mask already on the latent, so copies of this node chain. replace: discard the existing audio mask first. The video side of a joint mask is kept either way.
vaeoptVAEThe audio VAE used to encode this latent (for a joint AV latent, the audio VAE, not the video one). Required when timing is auto.
maskoptMASKMask over the audio timeline: time runs along the width axis, stretched to the audio duration. White = regenerate, black = keep.
time_rangesoptSTRINGComma-separated seconds forming in,out pairs (e.g. 0,1.5,3,4.25). Takes priority over mask and start/end when set.

Outputs (1)

NameTypeDescription
LATENTLATENTThe latent with the audio noise mask attached.