Nodes/ComfyUI-NKD-Basic-Tools/😺NKD Audio Mask
ComfyUI Node

😺NKD Audio Mask

The audio-branch mask that only regens the part of the clip you asked for

By Nekodificador·Created about a month ago·Updated 3 days ago· 71
😺NKD Audio Mask
  • audio_latent
  • mask
  • audio_latent
â—„ramp_ticks0â–º
â—„ramp_out_ticks0â–º
â—„ramp_shapecosineâ–º

You'd think "mask the soundtrack" would be a solved problem by now. It isn't, and the failure is sneaky: hand a plain video mask to Set Latent Noise Mask and the audio branch of an AV model like MiniMax H3 or LTXV gets regenerated from end to end, no matter what your mask said - with no error to tell you it happened. The stock node reads a mask as a picture, and a soundtrack has no picture in it. That's the trap this node exists to disarm.

😺NKD Audio Mask is the audio half of 😺NKD AV Latent, on its own, for when you'd rather keep the wiring out in the open. It slots exactly where Set Latent Noise Mask sits on the audio branch - VAE Encode Audio → NKD Audio Mask → Concat AV Latent - and it replaces both that node and the Solid Mask feeding it. Latent goes in, the same latent comes out with the mask already on it, timed to the soundtrack's real layout.

How it works

Only the timing of your mask survives. A video frame counts as masked if any pixel of it is masked, and the mask is then read as covering the whole clip. The node retimes it to the audio latent's own grid - 1/40 second per tick - so a mask edge lands within about 25 ms of where you drew it. Fine for a word boundary, too coarse for a consonant.

The two settings a beginner actually touches:

  • ramp_ticks - run-up into each regenerated stretch. The last ticks of the original sound rise toward the cut, so the model can rework the very end of the real audio to land on the generated bit. 0 keeps a hard seam; 8 ticks is 200 ms. The first regenerated tick is already fully new.
  • ramp_out_ticks - descent out of the regenerated stretch, back to original. The author's advice is worth trusting: leave this at 0 unless the return sounds abrupt, because a descent lets the model keep "transitioning" over audio that should simply resume.
  • ramp_shape - cosine eases in and out, linear is the plain control, high band spends the whole ramp inside 0.85–0.995, the narrow range of mask values these models actually distinguish.

The output is one audio_latent, ready for Concat AV Latent. That's the whole thing - it's deliberately a single-purpose node.

A couple of honest notes

The author says the timing is read off the latent you connect rather than assumed, and a latent it can't read gets refused with a message instead of silently masking the wrong thing. It's tested against MiniMax H3; LTXV should work but hasn't been run on a real clip, so treat LTX as "probably fine."

Install and gotchas

Install the pack via ComfyUI Manager (search ComfyUI-NKD-Basic-Tools) or:

cd ComfyUI/custom_nodes
git clone https://github.com/Nekodificador/ComfyUI-NKD-Basic-Tools

Restart ComfyUI after. Real dependencies are onnxruntime and huggingface_hub (from the pack's pyproject.toml) - the rest of the pack loads without them, so a missing onnxruntime only greys out the face nodes, not this one. If you're on a model that carries no audio branch at all, this node has nothing to mask - it exists for the AV models, not for silent video. And remember the H3 licence: if you're in the US, EU, UK or South Korea you can't legally run the local weights regardless of what node you use.

Category😺NKD Nodes/Masking

Inputs (5)

NameTypeDefaultDescription
audio_latentLATENTThe soundtrack, straight off VAE Encode Audio. Comes back with the mask on it, ready for Concat AV Latent.
maskMASKThe same mask you give the picture, one per video frame. Only its timing survives: a frame counts as masked if any pixel of it is, and the mask is read as covering the whole clip.
ramp_ticksINT00–40Run-up INTO each regenerated stretch, in audio ticks (1/40 s). The last ticks of the ORIGINAL sound before it rise toward the cut, so the model may rework the very end of the real audio to land on the generated one; the first regenerated tick is already fully new. 0 keeps the seam hard. 8 ticks = 200 ms.
ramp_out_ticksINT00–40Descent OUT of each regenerated stretch, back into the original sound. Separate from Ramp In because the exit usually wants a hard cut: a descent there lets the model keep 'transitioning' over audio that should simply resume. Leave at 0 unless the return sounds abrupt.
ramp_shapeCOMBOcosineBoth ramps. cosine eases in and out; linear is the control; high band spends the whole ramp between 0.85 and 0.995, the narrow range of mask values the model actually distinguishes.

Outputs (1)

NameTypeDescription
audio_latentLATENT—