FL Audio Segment Extractor
Cut audio and matching frame counts on exact beat boundaries
- audio
- audio_segment
- frame_count
- end_frame
Given a full track's beat positions and a starting beat plus a beat count, this node slices out exactly that span of audio - and, critically, computes the exact frame count that span corresponds to at your target framerate. That pairing matters more than it sounds: if you cut audio by raw seconds and cut video by separate frame-count math, rounding error compounds over a long edit and the two creep out of sync. Deriving both from the same beat positions keeps them locked to a single source of truth.
How it works
You give it beat_positions (from FL_Audio_BPM_Analyzer upstream), a start_beat to begin at, and a beat_count for how many beats long the segment should be. It returns the corresponding audio slice plus the exact frame_count and end_frame that span occupies at your chosen fps - no separate manual conversion between "beats" and "frames" required anywhere downstream.
The inputs and outputs that matter
Required: audio, beat_positions, start_beat (0–10000, default 0 - 0-indexed), beat_count (1–32, default 4 - four beats is one bar in common 4/4 time, which is why that's the default).
Optional: fps (1–120, default 30); start_frame (0–1,000,000, default 0 - an offset useful when you're stitching multiple segments together and want this segment's frame numbers to continue where a previous one left off, instead of restarting at 0).
Outputs: audio_segment (AUDIO), frame_count (INT), end_frame (INT).
How to install it
ComfyUI Manager: search ComfyUI_Fill-Nodes, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/filliptm/ComfyUI_Fill-Nodes
then restart. The audio-analysis dependency (librosa, for the BPM analyzer this node relies on upstream) lives elsewhere in the pack - this specific node is comparatively lightweight, doing slicing and arithmetic rather than analysis.
Common issues & troubleshooting
Segment lands on the wrong part of the song. beat_positions has to come from an actual BPM analysis of this exact audio file - if you're reusing beat data from a different track, or from a re-edited version of the same track, the beat positions won't line up and the slice will be wrong even though nothing errors.
Stitching multiple segments for a full edit. Use start_frame on each subsequent extractor call to keep frame numbering continuous across segments - otherwise every segment restarts its frame numbering at 0, which breaks any downstream logic assuming a single continuous timeline. If you've already built a full shot sequence rather than calling this node manually per segment, FL_Audio_Shot_Iterator is the node built to walk that sequence instead.
beat_count capped at 32. That's a hard ceiling in the schema - if you need a longer continuous segment than 32 beats, you'll need to chain multiple extractor calls (using start_frame to keep them contiguous) rather than trying to push past the limit in one call.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| audio | AUDIO | — | |
| beat_positions | STRING | — | |
| start_beat | INT | 00–10000 | — |
| beat_count | INT | 41–32 | — |
| fpsopt | INT | 301–120 | — |
| start_frameopt | INT | 00–1000000 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| audio_segment | AUDIO | — |
| frame_count | INT | — |
| end_frame | INT | — |