Nodes/Akatz Custom Nodes/Binary Amplitude Gate | Akatz
ComfyUI Node

Binary Amplitude Gate | Akatz

Turn an amplitude list into on/off — the audio gate

By akatz-ai·Created 2 years ago·Updated 9 months ago· 33
Binary Amplitude Gate | Akatz
    • FLOAT
    float_list
    min_value0.000
    max_value1.000
    threshold0.500

    Binary Amplitude Gate takes a list of float values - usually per-frame loudness from the pack's Schedule Audio Framesync - and snaps every value to one of two outputs based on a threshold. Above the threshold you get one value, below you get another. It's the digital version of a noise gate, and it's the cheapest way to make an animation feel "beat-locked."

    The name says it all: binary. There's no gradation, no smoothing. Each value becomes either min_value or max_value. That sounds crude, but it's exactly right for a lot of reactive work. Want a mask to slam open on the kick and stay shut between hits? Feed it gated values and drive a dilation node. Want to switch between two prompts, two images, or two colors based on whether the music is "hitting"? Gate the amplitude and feed the result into a switch. You get hard, rhythmic on/off motion instead of mushy always-slightly-on.

    How it works

    It's a one-line list comprehension in the source: every value below threshold maps to min_value, every value equal to or above maps to max_value. You set the two output states, so the gate can output 0/1, 0/1.0, or any pair of values your downstream node wants - even values outside the original amplitude range, since it's a pure remap. Nothing about the input range matters except where it sits relative to threshold.

    Inputs and output

    • float_list - the input FLOAT list (amplitude schedule, or any per-frame values).
    • min_value - the output value for values below threshold, default 0.
    • max_value - the output value for values at or above threshold, default 1.
    • threshold - the cutoff, default 0.5.

    Output is a FLOAT list (output_list), same length, each element either min_value or max_value. All three numeric inputs have an enormous allowed range (±1e10) so you can remap to basically anything.

    Installing it

    Part of akatz-ai/ComfyUI-AKatz-Nodes. Install via ComfyUI Manager (search "AKatz") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/akatz-ai/ComfyUI-AKatz-Nodes
    cd ComfyUI-AKatz-Nodes
    pip install -r requirements.txt
    

    Restart ComfyUI. No model downloads; requirements are numpy, torch, opencv-python and pydub.

    Common issues

    The trap is a threshold that never gets crossed - if your amplitude source tops out below threshold, the whole list collapses to min_value and your animation sits dead. Check the actual range of your input before blaming the gate. Also remember there's zero hysteresis: a value sitting right at the threshold will chatter between states if your source is noisy, so pair it with a smoothed amplitude list (ease it via curves_mode in Schedule Audio Framesync) for reliable triggering.

    Category💜Akatz Nodes/Audio

    Inputs (4)

    NameTypeDefaultDescription
    float_listFLOAT
    min_valueFLOAT0.000-10000000000–10000000000
    max_valueFLOAT1.000-10000000000–10000000000
    thresholdFLOAT0.500-10000000000–10000000000

    Outputs (1)

    NameTypeDescription
    FLOATFLOAT