LC Audio Duration ⏱️
Measure a soundtrack in seconds and minutes, as numbers a graph can branch on
- audio
- seconds_int
- seconds_float
- minutes_int
- minutes_float
Every time you want a soundtrack to line up with a clip, you hit the same question: how long is this audio? LC Audio Duration answers it by turning an AUDIO input into plain numbers - seconds and minutes, both as integers and floats - that the rest of your graph can compare, feed into text, or use to drive logic.
In the ComfyUI video world this kind of node is quietly load-bearing. Audio is the newest layer of the stack, bolted on after silent clips needed sound, and it lives in bespoke packs with their own conventions (see the KB's audio essay for the lay of that land). A duration node is your bridge between the audio side and the video side: the clip is frame_count / frame_rate seconds, the track is whatever this node measures, and matching them is arithmetic. It's the same contract as the Audio Duration nodes from other suites (the brief names the output pair seconds_int/seconds_float and minutes_int/minutes_float as its matching layout), which means this is a drop-in if you're swapping packs around.
How it works
Nothing fancy under the hood: Comfy AUDIO carries a waveform tensor and a sample rate, so duration is just sample_count / sample_rate. The integer outputs are the floored value; the float outputs keep the fraction. That's the whole mechanism - which is exactly why it's dependable. No decode, no inference, no file I/O; it runs instantly and always matches what a downstream encoder will see, because both are computing the same thing from the same tensor.
The outputs that matter
seconds_float- the one you'll reach for: precise length in seconds (e.g.12.48).seconds_int- the same, truncated to a whole number, for widget inputs that demand an INT.minutes_float/minutes_int- length in minutes, for when you're thinking in track lengths.
The classic wiring: feed an LC Load Audio (or any AUDIO source) into audio, take seconds_float, and compare it against a video's computed duration from an LC_AV_PIPE or LC Create Video. Longer track than clip? Trim with LC Audio Crop or loop. Shorter? You now have a number to loop against without eyeballing a timeline.
How to install it
This is one node in the lonecatone23/ComfyUI_LC_AV_nodes pack (the author's LC Audio_Video toolkit, MIT, the audio/video sibling of ComfyUI_LC123_nodes - don't merge the two repos). Install once for the family:
- ComfyUI Manager: search "LC Audio_Video" or
ComfyUI_LC_AV_nodes. - Manual:
cd ComfyUI/custom_nodes && git clone https://github.com/lonecatone23/ComfyUI_LC_AV_nodes, restart ComfyUI.
You should see [LC AV] total 16 nodes in the console. No extra dependencies and no model downloads for this node.
Gotchas
If the audio is a silent or zero-sample buffer, the outputs come back as 0/0.0 rather than erroring - so "0 seconds" from a loaded file usually means the file decoded to nothing upstream, not that the node is broken. And note the outputs are plain numbers, not pipes: they're meant to be compared and fed forward, so if you find yourself re-measuring the same track in five places, pull the value once and fan it out.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| audio | AUDIO | Comfy AUDIO {waveform, sample_rate}. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| seconds_int | INT | — |
| seconds_float | FLOAT | — |
| minutes_int | INT | — |
| minutes_float | FLOAT | — |