Nodes/ComfyUI-SRT-subtitles-VoxCPM/Audio Trimmer (by Timestamp)
ComfyUI Node

Audio Trimmer (by Timestamp)

Grab the exact 2 seconds of audio you need, without a timeline widget

By judian17·Created 10 months ago·Updated 10 months ago· 7
Audio Trimmer (by Timestamp)
  • audio
  • AUDIO
timestamp00:00:00,000 --> 00:00:05,000

If you've ever had a 40-minute recording and just wanted the one clean sentence where someone actually introduces themselves, this is the node. It slices an audio clip by an SRT-style timestamp and hands you only the segment you asked for. In this pack it exists for one very practical reason: the VoxCPM Cache Builder needs a short reference clip of a speaker's voice, and Load Audio gives you whole files, not excerpts.

How it works

You feed it an AUDIO and a timestamp string in the exact SRT format:

00:00:06,500 --> 00:00:08,000

It parses that into start and end seconds, converts them to sample indices using the audio's own sample rate, slices the waveform, and passes the same sample rate through to the output. That last part matters: the audio comes out still usable by every other node in the pack because the trimmer never changes the sample rate or resamples anything.

Two inputs, that's the whole node: audio (from Load Audio or anything else that emits AUDIO) and timestamp (a single-line string, default 00:00:00,000 --> 00:00:05,000). One output, AUDIO, which you wire straight into the Cache Builder's prompt_audio port.

The two things that bite people

Use commas, not dots, in the timestamp. SRT format is HH:MM:SS,mmm, and parse_time is strict about it. Feed it 00:00:06.500 and it'll log "Failed to parse timestamp" and hand you the entire original audio back. That silent passthrough behavior is the other gotcha: on any parse error, or if start ≥ end, the node returns the input unchanged and only complains in the console. If your output is suspiciously long, glance at the terminal before you blame the model.

For a voiceprint, you want a clean, single-speaker segment - five to ten seconds of someone talking without background music or another person interrupting. Anything shorter than a couple of seconds and the cloned voice gets shaky; longer just wastes cache-build time.

Installing it

This node ships in the ComfyUI-SRT-subtitles-VoxCPM pack, so install the pack, not this node alone:

cd ComfyUI/custom_nodes
git clone https://github.com/judian17/ComfyUI-SRT-subtitles-VoxCPM

Then restart ComfyUI (or install via ComfyUI Manager by searching "SRT subtitles VoxCPM"). The pack's requirements include librosa, pydub and soundfile, and the model itself auto-downloads on first run into ComfyUI/models/TTS - the trimmer itself has no extra dependencies. It's a tiny utility that doesn't even need the model loaded, so you can use it to audition clips before you've gone anywhere near the VoxCPM Loader.

Categoryaudio/tts

Inputs (2)

NameTypeDefaultDescription
audioAUDIO
timestampSTRING00:00:00,000 --> 00:00:05,000

Outputs (1)

NameTypeDescription
AUDIOAUDIO