Nodes/KJNodes for ComfyUI/OffsetMaskByNormalizedAmplitude
ComfyUI Node Runs on cloud

OffsetMaskByNormalizedAmplitude

Make a mask shake and spin to the beat

By kijai·Created 3 years ago·Updated about 12 hours ago· 2,930
OffsetMaskByNormalizedAmplitude
  • normalized_amp
  • mask
  • mask
x0
y0
rotatefalse
angle_multiplier0.000

This combines two things already in this pack: the shift-and-rotate mechanism from Offset Mask, and the audio-amplitude bridge that Normalized Amplitude To Mask uses. Instead of a fixed offset, the mask's movement scales with how loud the audio is at that moment - quiet passages barely move it, loud hits push it further. It's the node for a mask that visibly reacts to music rather than one that's just tinted or brightened by it.

How it reads

  • normalized_amp - same amplitude source as the other audio-bridge nodes in this pack, sourced from the separate AudioScheduler pack.
  • mask in, mask out.
  • x, y - read these as the maximum offset the mask gets pushed at full amplitude; the actual per-frame movement scales down from there as the sound level drops, rather than being a fixed shift every frame.
  • rotate - a boolean gate. Leave it off and the mask only translates; turn it on to let amplitude drive rotation as well as position.
  • angle_multiplier (−1 to 1, default 0) - how much rotation the amplitude produces once rotate is on. At 0, rotate being on does nothing - you need a nonzero multiplier for rotation to actually show up.

Where this fits

Think of it as the "shake" counterpart to Normalized Amplitude To Mask's "pulse." That node changes a shape's brightness or size with the beat; this one moves the shape itself. Layer both on separate masks and you get something that genuinely looks alive - a spotlight that both brightens and jitters with a kick drum, say. The output feeds anywhere a normal mask would: inpainting regions, blend masks, crop windows.

How to install it

Two packs required, same as the rest of this audio-reactive family: KJNodes itself via ComfyUI Manager (search "KJNodes for ComfyUI") or cd ComfyUI/custom_nodes && git clone https://github.com/kijai/ComfyUI-KJNodes followed by pip install -r ComfyUI-KJNodes/requirements.txt and a restart, plus a1lazydog/ComfyUI-AudioScheduler installed separately to actually generate the normalized_amp value this node needs. Skipping the second pack means you'll have nothing to wire into the amplitude input.

Common issues & troubleshooting

Rotation not happening even with rotate on. Check angle_multiplier - it defaults to 0, which means "no rotation" regardless of the rotate toggle. You need both: the gate open, and a nonzero multiplier.

No normalized_amp source available. Install AudioScheduler if you haven't - this node's amplitude input doesn't exist as a native ComfyUI type on its own.

Movement feels too extreme or too subtle. Since x/y set the ceiling at full amplitude rather than a flat offset, the fix usually isn't the audio settings upstream - it's these two numbers. Scale them down for subtlety, up for a more obviously reactive effect, and iterate against the actual audio you're using rather than guessing.

This is meant for autoqueue. Like the rest of the audio-reactive cluster in this pack, it's designed to be re-evaluated every frame in a running queue, not to produce one static result. If you're only running it once, you'll get one offset at whatever amplitude happened to be current at that moment.

CategoryKJNodes/audio

Inputs (6)

NameTypeDefaultDescription
normalized_ampNORMALIZED_AMPLITUDE
maskMASK
xINT0-4096–16384
yINT0-4096–16384
rotateBOOLEANfalse
angle_multiplierFLOAT0.000-1–1

Outputs (1)

NameTypeDescription
maskMASK