Nodes/MKRShift_Nodes/Beat Marker Grid
ComfyUI Node

Beat Marker Grid

Get beat and bar timestamps to cut against

By criskb·Created 7 months ago·Updated 5 months ago· 0
Beat Marker Grid
    • beat_markers_json
    • bar_markers_json
    • beat_count
    • bar_count
    • summary
    bpm120.0
    duration_sec60.00
    beats_per_bar4
    offset_sec0.00

    Music-synced editing is one of those things that looks impressive and is secretly just arithmetic: if you know the BPM, you know exactly where every beat lands in time. MKRBeatMarkerGrid is that arithmetic, exposed as a node - feed it a tempo and a duration, and it hands back a JSON list of every beat and every bar marker, plus counts. It's a metronome for your timeline, and it's the backbone for "cut on the beat" workflows in MKRShift_Nodes.

    It lives in the Media/Timeline branch, alongside the beat-sync and freeze-frame detection nodes. What makes it useful is that it takes no audio input at all - you supply the BPM, it does the math. This is a feature: you can generate a beat grid for a track you're planning to add, or grid out a section in 4/4 without decoding anything.

    How it works

    Beat position in seconds is 60 / bpm. The node walks from offset_sec (default 0, and it handles negative offsets by stepping forward until the time is non-negative) through duration_sec, stamping a beat every beat-interval and a bar every beats_per_bar beats (default 4). Output:

    • beat_markers_json - a JSON array of beat timestamps in seconds.
    • bar_markers_json - a JSON array of the bar-start timestamps (a subset of the beats, the ones at the start of each bar).
    • beat_count / bar_count - the two counts as plain INTs.
    • summary - JSON with BPM, duration, interval, and the counts.

    No files are written, no audio is touched. Wire the JSON into anything that consumes marker lists - this pack's MKRBeatSyncRetimer and timeline nodes are the natural downstream, or use the INTs to drive a count-based loop.

    Inputs that matter

    • bpm - 1 to 400, default 120. The tempo. Half-time or double-time in the dropdown, not the node.
    • duration_sec - 0 to 86400, default 60. How long the grid runs.
    • beats_per_bar - 1 to 16, default 4. Time signature in beats per bar (3 for waltz, 6 for compound, etc.).
    • offset_sec - −60 to +60, default 0. Where the grid starts relative to time zero; negative means beats begin before the clip start (handy when the downbeat lands a bit in).

    Install

    ComfyUI Manager (search "MKRShift Nodes"), or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/criskb/MKRShift_Nodes
    

    Restart. This is the lightest node in the pack - pure arithmetic, zero dependencies, no ffmpeg, no models.

    Common issues

    The trap is expecting it to detect a tempo. It won't - BPM is an input, not a measurement, so if you don't know the track's tempo you're guessing until you get the grid in sync. For a generated track, pair it with an audio analysis node that reports BPM, or just loop with MKRAudioTempoPitch until the grid lines up. Second, duration_sec is a hard cap, not a count - if your cut is 61 seconds and you ask for 60, the last beat is missing; add a second or two of margin and trim downstream. And beat markers are straight math, so a track with tempo changes (ritardando, a dropped beat) will drift from a single fixed BPM - that's physics, not a bug.

    CategoryMKRShift Nodes/Media/Timeline

    Inputs (4)

    NameTypeDefaultDescription
    bpmFLOAT120.01–400
    duration_secFLOAT60.000–86400
    beats_per_barINT41–16
    offset_secFLOAT0.00-60–60

    Outputs (5)

    NameTypeDescription
    beat_markers_jsonSTRING
    bar_markers_jsonSTRING
    beat_countINT
    bar_countINT
    summarySTRING