Nodes/Anymatix/Anymatix Audio Duration
ComfyUI Node

Anymatix Audio Duration

Read an audio clip's length off the file itself — stop guessing the duration in your workflow

By Anymatix·Created about a year ago·Updated 2 days ago· 0
Anymatix Audio Duration
  • audio
  • duration
  • sample_rate
  • samples

Here's a frustratingly common problem in audio-plus-video workflows: the clip length has to come from somewhere, and ComfyUI's stock nodes mostly ask you to type it. Type 10 seconds, and the actual audio is 10.3 - and your generated video either cuts off the tail or runs on into silence. AnymatixAudioDuration is the small node that asks the file instead of the person. Feed it any AUDIO object and it reports the exact length in seconds, along with the sample rate and sample count.

The pack's own comment on this node is blunt about why it exists: a workflow that takes audio has three candidate lengths - the audio, a guide video, and whatever number a card asks for - and only one of them can win. Asking the user is the worst of the three, because the file already knows, and every mismatch is a clip that ends early or drifts into dead air. So this node measures, and the measurement can drive the rest of the graph.

How it works

It's almost boringly simple, which is the point. In ComfyUI, an AUDIO object is a dict holding a waveform tensor and its sample rate. Duration is a division - samples divided by sample rate - but before this node, nothing inside a graph could reach that number. AnymatixAudioDuration does the division and hands you all three facts:

  • duration (FLOAT) - seconds, to whatever precision the file warrants.
  • sample_rate (INT) - e.g. 44100 or 48000.
  • samples (INT) - the raw sample count.

Where it shines

Wire duration into AnymatixFrameCount and you get the exact number of frames your video model will accept for this audio - the file's real length, snapped to the model's frame grid, no manual syncing. It's the kind of plumbing that turns "I'll trim in post" into a workflow that just lines up. Nothing about it is LTX-specific; any audio-conditioned generation benefits, but the frame-sync use case is where you'll actually feel it.

Install

The standard pack routine:

cd ComfyUI/custom_nodes
git clone https://github.com/Anymatix/anymatix-comfy-nodes

then restart ComfyUI, or use ComfyUI Manager (search "anymatix-comfy-nodes"). No model downloads - this node touches no weights at all.

Issues to expect

Not many, because it does so little. The main beginner trip-up is expecting it to work on a file path - it doesn't take a filename, it takes an AUDIO object that has already been decoded and loaded by an earlier node (an audio loader or the output of a generation node). If you're looking at a file on disk, load it first. And if your duration comes back zero or nonsense, check whether the audio actually carried its sample rate through the pipeline - some save/trim nodes are sloppy about preserving it.

CategoryAnymatix

Inputs (1)

NameTypeDefaultDescription
audioAUDIOThe audio to measure.

Outputs (3)

NameTypeDescription
durationFLOAT
sample_rateINT
samplesINT