Nodes/ComfyUI-Rhythm-Tracks/Draw Rhythm Tracks
ComfyUI Node

Draw Rhythm Tracks

A beat-locked point that turns rhythm into motion control

By grmchn·Created 4 months ago·Updated 4 months ago· 0
Draw Rhythm Tracks
    • IMAGE
    bpm140.0
    fps24.0
    length5.0
    width512
    height512
    start_x256
    start_y128
    pattern_xpendulum
    pattern_ybounce
    rate_x0.50
    rate_y0.25
    rhythm_x0.25
    rhythm_y1.00
    delay0.00

    Draw Rhythm Tracks is the reason this pack exists. It renders a sequence of images of a single colored point swinging in time with a BPM - a fading trail of dots tracing a path - and those frames are exactly the kind of thing video models take as motion control. The README says it plainly: the output is for LTXVideo and other motion-control workflows, and the source even swaps the frames to BGR "to match IC-LoRA training data format." If you've seen the LTX ecosystem's in-context LoRAs condition generation on a control video, this is you building that control video from a rhythm instead of drawing it by hand.

    Why would you want a floating dot as a control signal? Because a prompt cannot express "swing on the downbeat, hold still for the rest of the bar" - a point that traces that path absolutely can. It's the cheapest, most readable way to hand a motion-conditioned model an exact trajectory that's also locked to your music.

    How it works

    The mechanism is neat and worth understanding, because the knobs stop being mysterious once you do. Each frame gets a time value, the phase is computed as (frame_time / beat_period) × rhythm × 2π, and that phase drives one of three swing patterns:

    • pendulum - a sine wave: smooth easing through the swing, slower at the extremes.
    • bounce - a parabolic arch with a phase shift so the point starts at rest and hops.
    • linear - a triangle wave: constant-speed back-and-forth, the "mechanical" feel.

    Position is start_x/start_y plus the pattern's offset, scaled by rate_x/rate_y as a fraction of the image size. The point has a trail up to 50 frames, color-coded by age (old dots fade toward blue, fresh ones burn red), and its radius scales with the output resolution. All rendered as filled circles per frame - pure PyTorch, no external imaging library.

    The inputs that actually matter

    There are fourteen of them, but you'll touch these:

    • bpm - the tempo. One beat is one swing cycle, unless you multiply it (below).
    • fps and length - frame rate and duration. These set your frame count.
    • width / height / start_x / start_y - the canvas and where the swing centers.
    • rate_x / rate_y - how far the point travels, as a ratio of the image dimension. 0.5 means it sweeps across half the width.
    • rhythm_x / rhythm_y - the sneaky-good ones. Effective BPM is bpm × rhythm_x, so with a 140 track you can make the X axis swing at quarter-note speed (rhythm_x 0.25) while Y does a slow whole-bar bob (rhythm_y 1.0). Independent X/Y timing is what separates "motion" from "metronome."

    The single output is IMAGE - a batch of frames, one per rendered frame. Wire it into VHS_VideoCombine (the bundled example workflows do exactly this) to get an mp4, or feed the frames into your LTX control-video slot.

    Where it bites

    • The render loop is pure Python per frame, so long lengths at high fps on big canvases get slow. 512×512 at 24fps for 5 seconds is instant; pushing 8192-wide frames at 120fps will make you wait.
    • The trail is a fixed 50 frames. At 24fps that's a ~2 second tail; at 60fps it collapses to under a second. If your trail suddenly looks short, check your fps first.
    • The colors are BGR on purpose. The frame swap matches how the author's IC-LoRA data was trained. If a preview looks slightly color-wonky in an RGB viewer, that's not a bug - it's the contract with the model.

    Install

    ComfyUI Manager - search "ComfyUI-Rhythm-Tracks" - or by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/grmchn/ComfyUI-Rhythm-Tracks
    cd ComfyUI-Rhythm-Tracks
    pip install -r requirements.txt
    

    That's librosa and torchaudio on top of ComfyUI's own torch/numpy. No models to download. One gotcha: the pack is built against ComfyUI's newer Node SDK (comfy_api.latest), so a stale ComfyUI install will refuse to load it - update ComfyUI first if the node doesn't appear. It's a small hobbyist pack (grmchn, GPL-3.0, Japanese README), but it's self-contained enough that the source in nodes.py is the best debugging doc you have.

    Categoryrhythm/motion_tracking

    Inputs (14)

    NameTypeDefaultDescription
    bpmFLOAT140.030–300Tempo in beats per minute. One beat = one swing cycle.
    fpsFLOAT24.01–120Output frame rate.
    lengthFLOAT5.00.1–60Output duration in seconds.
    widthINT5128–8192Output image width in pixels.
    heightINT5128–8192Output image height in pixels.
    start_xINT2560–8192Swing center point X coordinate.
    start_yINT1280–8192Swing center point Y coordinate.
    pattern_xCOMBOpendulumX-axis swing pattern.
    pattern_yCOMBObounceY-axis swing pattern.
    rate_xFLOAT0.500–1Horizontal swing width as ratio of image width.
    rate_yFLOAT0.250–1Vertical swing width as ratio of image height.
    rhythm_xFLOAT0.250.01–10X-axis BPM multiplier. Effective BPM = bpm * rhythm_x.
    rhythm_yFLOAT1.000.01–10Y-axis BPM multiplier. Effective BPM = bpm * rhythm_y.
    delayFLOAT0.00-10–10Time offset in seconds. Negative = earlier, positive = later.

    Outputs (1)

    NameTypeDescription
    IMAGEIMAGE