Nodes/ComfyUI-Apt_Preset/Amp_drive_mask
ComfyUI Node

Amp_drive_mask

A mask that pulses with whatever curve you feed it

By cardenluo·Created 2 years ago·Updated 18 days ago· 309
Amp_drive_mask
    • MASK
    normalized_amp
    width512
    height512
    frame_offset0
    location_x256
    location_y256
    size128
    shapenone
    coloramplitude

    Most mask nodes give you a static shape. This one gives you a shape that listens. Feed it a normalized 0-1 driving value - an audio amplitude curve is the obvious one, but honestly any animated float works - and it draws a circle, square, or triangle whose position, size, and brightness track that value frame by frame. It lives in the pack's AD category, and that's the tell: this is cardenluo's own entry into the audio-reactive AnimateDiff niche, the small but genuine corner of the community that drives keyframe transitions, ControlNet strength, and motion amount straight off separated audio stems rather than hand-keyframing everything. That workflow style has a real following even now that Wan and other video models have eaten most of AnimateDiff's other use cases - the morphing, pulsing, beat-synced look is a taste people keep AnimateDiff around for.

    What it actually does

    You give it a driving signal (normalized_amp) and a canvas size, and it stamps a shape onto that canvas as a mask. The shape's screen position comes from location_x/location_y, its size from size, and - this is the part that makes it "amp drive" rather than just a shape generator - the color setting lets the mask's brightness itself track the amplitude. Set color to amplitude and you get a mask that's dim when the signal is low and bright (fully opaque) when it spikes, instead of a flat on/off cutout. That's the difference between "this region is either masked or it isn't" and "this region gets stronger exactly in proportion to how loud/intense the moment is" - genuinely useful if you're feeding the result into something that respects mask strength gradually, like an IPAdapter region or a soft compositing blend.

    Inputs and outputs that matter

    Beginners really only need three: normalized_amp (your driving curve - wire in whatever you're using to compute per-frame amplitude), shape (pick circle, square, triangle, or none to skip drawing entirely), and color (white for a plain shape mask, amplitude for the pulsing version). width/height set the canvas to match your generation resolution, location_x/location_y and size place and scale the shape, and frame_offset shifts the timing by a number of frames if your animation curve needs to lead or lag the shape by a beat or two. The single output is a MASK - wire it into anything that takes a mask: a masked ControlNet, an inpaint region, an IPAdapter attention mask.

    Installing it

    Search "ComfyUI-Apt_Preset" in ComfyUI Manager, or do it by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/cardenluo/ComfyUI-Apt_Preset.git
    

    then run install.bat (Windows) - on Linux/Mac, pip install -r requirements.txt inside the cloned folder does the same job - and restart ComfyUI. This node has no model to download and no extra dependency beyond the base install; it's pure math and pixel drawing.

    Common issues

    The whole node lives or dies on what you plug into normalized_amp - the pack doesn't include a dedicated audio-amplitude extractor node in this batch, so you're responsible for getting a genuinely 0-1 normalized value into it, from an audio node pack, a manually scheduled curve, or anything else that outputs a float per frame. Feed it something that isn't clamped to 0-1 and the shape's brightness (in amplitude mode) will just clip. If the mask shows up but does nothing downstream, check that whatever you're feeding it actually reads mask strength, not just presence - a lot of nodes treat any nonzero mask value as "fully masked," which throws away the whole point of the amplitude color mode.

    One general note worth knowing before you install anything from this pack: it's a relatively obscure, single-maintainer project translated from a Chinese-language original (there's a linked Bilibili channel and a README_ZH.md), and at least one user has reported it throwing an IMPORT FAILED line in the ComfyUI console. If that happens to you, it's almost always a skipped dependency - rerun install.bat (or the pip command) and do a full restart, not just a browser refresh.

    CategoryApt_Preset/AD

    Inputs (9)

    NameTypeDefaultDescription
    normalized_ampFLOAT
    widthINT51216–4096
    heightINT51216–4096
    frame_offsetINT0-255–255
    location_xINT2560–4096
    location_yINT2560–4096
    sizeINT1288–4096
    shapeCOMBOnone4 options: none, circle, square, triangle
    colorCOMBOamplitude2 options: white, amplitude

    Outputs (1)

    NameTypeDescription
    MASKMASK