π΅ A ComfyUI custom node for intelligent audio segmentation with overlap support
Split audio at integer-second start points with decimal-duration segments, designed for context-aware audio processing tasks.
- Features
- Use Cases
- Installation
- Usage
- How It Works
- Example Output
- Workflow Examples
- Technical Details
- Troubleshooting
- Contributing
- License
- Changelog
- π― Integer-Second Start Points: Split at 0s, 10s, 20s, 30s...
- π Decimal Segment Duration: Support for 10.44s, 20.28s, etc.
- π Intentional Overlap: Preserve context between segments
- β±οΈ Timestamp Information: Detailed start/end times for each segment
- π ASCII Visualization: Timeline preview of segmentation
- π Zero Dependencies: Uses ComfyUI built-in libraries
- ποΈ Flexible Output: Independent audio segments as list
Perfect for audio processing tasks requiring contextual information:
- π€ Speech Recognition: Prevent sentence truncation at split points
- π΅ Music Analysis: Maintain note and beat integrity
- π Audio Transcription: Ensure sufficient context per segment
- π¬ Video Dubbing: Align audio segments for post-production
- π§ͺ Audio Research: Consistent windowing for ML/AI applications
- Open ComfyUI Manager
- Search for "Audio Segment Splitter" or "comfy_AudioSeg"
- Click Install
- Restart ComfyUI
cd ComfyUI/custom_nodes
git clone https://github.com/huangkun1985/comfy_AudioSeg.git
# Restart ComfyUI- Download the latest release
- Extract to
ComfyUI/custom_nodes/comfy_AudioSeg/ - Restart ComfyUI
- Find the Node: Right-click in ComfyUI β Search "Audio Segment Splitter" (under
audiocategory) - Connect Input: Link an audio source (e.g.,
LoadAudio) - Set Duration: Configure
segment_durationparameter (default: 10.0s) - Run: Execute workflow to get segmented audio
| Parameter | Type | Description | Default | Range |
|---|---|---|---|---|
audio |
AUDIO | Input audio data | - | - |
segment_duration |
FLOAT | Segment length in seconds | 10.0 | 0.1 - 3600.0 |
| Output | Type | Description |
|---|---|---|
segments |
AUDIO (List) | Independent audio segment list |
segment_info |
STRING | Detailed timing info & visualization |
Example: 60-second audio with segment_duration = 10.44s
Start Point (int) β Segment Range β Duration β Overlap
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
0s β [0.00 - 10.44s] β 10.44s β -
10s β [10.00 - 20.44s] β 10.44s β 0.44s
20s β [20.00 - 30.44s] β 10.44s β 0.44s
30s β [30.00 - 40.44s] β 10.44s β 0.44s
40s β [40.00 - 50.44s] β 10.44s β 0.44s
50s β [50.00 - 60.00s] β 10.00s β 0.44s (final)
# Integer-second start points
split_interval = int(segment_duration) # 10.44 β 10
start_points = [0, 10, 20, 30, ...]
# Extract segments with decimal duration
for start in start_points:
segment = audio[start : start + segment_duration]================================================================================
Audio Segmentation Preview
================================================================================
Total Duration: 60.00 seconds
Segment Duration: 10.44 seconds
Start Interval: 10 seconds (integer)
Segment Overlap: 0.44 seconds
Number of Segments: 6
--------------------------------------------------------------------------------
Segment Details:
Index Start Time End Time Duration Notes
--------------------------------------------------------------------------------
0 0.00 10.44 10.44
1 10.00 20.44 10.44 (0.44s overlap with previous)
2 20.00 30.44 10.44 (0.44s overlap with previous)
3 30.00 40.44 10.44 (0.44s overlap with previous)
4 40.00 50.44 10.44 (0.44s overlap with previous)
5 50.00 60.00 10.00 (Final segment, shorter)
================================================================================
Timeline Visualization:
Time: 0.0 6.0 12.0 18.0 24.0 30.0 36.0 42.0 48.0 54.0 60.0
|------|------|------|------|------|------|------|------|------|------|
# 0: [============]
# 1: [============]
# 2: [============]
# 3: [============]
# 4: [============]
# 5: [==========]
================================================================================
Example workflows are included in the workflow/ directory:
LoadAudio β AudioSegmentSplitter β PreviewAudio
β
segment_info β ShowText
LoadAudio β AudioSegmentSplitter β [Process Each Segment] β AudioConcat
β
segment_info β SaveText
| Scenario | segment_duration |
Effect |
|---|---|---|
| With Overlap | 10.44 | 0.44s overlap between segments |
| No Overlap | 10.0 | Exact split, no overlap |
| Short Segments | 5.5 | 0.5s overlap, 5s intervals |
| Long Segments | 30.2 | 0.2s overlap, 30s intervals |
{
"waveform": torch.Tensor, # Shape: (batch, channels, samples)
"sample_rate": int # Sample rate in Hz
}- torch: PyTorch tensor operations
- logging: Console output
All dependencies are included with ComfyUI - no additional installation required!
- β‘ Optimized with PyTorch native operations
- πΎ Memory-efficient tensor slicing
- π§ Works with any sample rate
- π¦ Supports mono and stereo audio
- Segment < 1s: Start interval automatically adjusted to 1s
- Final Segment: Automatically truncated to audio end
- No Overlap: Use integer values (e.g., 10.0, 20.0)
Solution:
- Verify installation path:
ComfyUI/custom_nodes/comfy_AudioSeg/ - Check ComfyUI console for errors
- Restart ComfyUI completely
Cause: Sharp cutoff in waveform
Solution: Add fade in/out in post-processing (future feature)
Solution: Ensure ComfyUI is up-to-date with PyTorch installed
Run the included test suite:
cd ComfyUI/custom_nodes/comfy_AudioSeg
python test_splitter.pyTests include:
- β Basic segmentation (60s β 10.44s segments)
- β No-overlap mode (30s β 10.0s segments)
- β Short segments (10s β 0.5s segments)
- β Final segment handling
We welcome contributions! Here's how you can help:
- π Report Bugs: Open an issue
- π‘ Suggest Features: Start a discussion
- π§ Submit PRs: Fork, code, test, and submit!
- π Improve Docs: Help us make the documentation better
git clone https://github.com/huangkun1985/comfy_AudioSeg.git
cd comfy_AudioSeg
# Make changes and test
python test_splitter.pyThis project is licensed under the MIT License - see the LICENSE file for details.
See CHANGELOG.md for version history and release notes.
- ComfyUI Team: For the amazing framework
- Community: For feedback and suggestions
- Contributors: See Contributors
- π« Issues: GitHub Issues
- π¬ Discussions: GitHub Discussions
- β Star us: If you find this useful!
Version: 1.0.0 | Last Updated: 2025-11-29
