Save Audio w/ Length ⚡
FLAC, MP3 or Opus, anywhere on your disk
- audio
- audio
- length
ComfyUI's built-in Save Audio dumps a FLAC into output/ and stops there. The moment your TTS output needs to land somewhere specific - a string of clips for a video editor, a shared folder, a path your other tooling already watches - you're copying files by hand. Save Audio w/ Length ⚡ writes to any folder you give it, picks your codec, and hands you the clip's duration as a bonus.
It's the audio cousin of the same pack's Save Image to Folder, and it comes from the same philosophy: your disk, your rules. The pack itself is pure plumbing, so you'll find no fanfare around it - that's normal for utility nodes that just quietly work.
Inputs worth setting
Five inputs, all required, and only four of them are decisions.
audio- theAUDIOto write.save_location- the important one. The author's own tooltip: "Blank = ComfyUI/output. Relative paths are beneath ComfyUI/output. Absolute paths are supported." Sovoiceovers/run7lands insideComfyUI/output/voiceovers/run7, while~/Audio/run7orD:/audio/run7goes exactly where it says.~is expanded. Missing folders are created for you.filename_prefix- defaultComfyUI. Keep it to a plain name: the code strips any directory part off before using it, so you can't create subfolders here. That's whatsave_locationis for.format-flac(default),mp3, oropus.quality-V0,64k,96k,128k,192k,320k, defaulting to128k.
Two outputs: the audio passed through unchanged, and length as a FLOAT - the clip's duration in seconds, same math as the preview node in this pack (samples ÷ sample rate). It's an output node, so it always runs.
Formats and what the quality setting actually does
The quality dropdown lists six values, but each codec only honours some of them, and that's where people get confused:
- FLAC - lossless.
qualityis ignored entirely. Best default for anything you'll edit or re-encode later. - MP3 - only
V0,128kand320kare real.V0maps to LAME's highest VBR quality; anything else you pick gets quietly coerced to128k. So64kon MP3 is not 64 kbps, it's 128. - Opus -
64kthrough320k, and noV0. Great quality per byte, but see the resampling note below.
Encoding goes through PyAV into an in-memory buffer and then to disk, so nothing lands in ComfyUI/temp on the way. Only mono and stereo are supported; a waveform with more channels raises.
Filenames are prefix_00001.flac and never overwrite - the node walks a counter until it finds a free name. Batch a few clips in one AUDIO and each item gets its own file with a _000, _001 suffix on the prefix.
Install
ComfyUI Manager: search ComfyUI-Get-Random-File, install, restart.
Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/ChrisColeTech/ComfyUI-Get-Random-File
No model downloads. requirements.txt is just imageio-ffmpeg and requests.
One discovery note: this node isn't in the pack's README - it documents the random-file and image-saving nodes. These audio nodes ship regardless; look in the node menu under 🤖 CCTech/Files or search the class name.
Common issues
Opus at 44.1 kHz dies with RuntimeError: Saving Opus at this sample rate requires torchaudio for resampling. Opus only supports 8k/12k/16k/24k/48k, and the node snaps your sample rate up to the next supported one. A 44.1 kHz source becomes 48 kHz, and that resample needs torchaudio, which this pack does not ship. If you have torchaudio you're fine; if not, use FLAC or MP3, or convert upstream.
"Only mono or stereo audio is supported; got N channels." A surround or multi-mic waveform. Downmix before saving.
The file isn't where you expected. Check whether your path was relative - everything relative is anchored under ComfyUI/output, which surprises people who typed audio/mixes expecting it to be relative to the ComfyUI root. Use an absolute path when in doubt.
Everything vanished after a ComfyUI update. audio_w_length.py imports av and comfy_api.latest at module load, and __init__.py imports it unconditionally - so on an older ComfyUI where comfy_api.latest is missing, the import fails and every node in the pack disappears, not just the audio ones. Update ComfyUI rather than reinstalling.
Your writes aren't self-documenting. Unlike a PNG, an audio file carries no embedded workflow - the "the metadata is the payload" convention doesn't apply to FLAC/MP3/Opus. Once saved, the graph that made it isn't in the file; keep the workflow JSON next to it or in a note node. And ComfyUI's console prints a [CCTech Suite]: ... Activated N file nodes. line at startup, which is how you confirm the pack loaded at all.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| audio | AUDIO | — | |
| save_location | STRING | Blank = ComfyUI/output. Relative paths are beneath ComfyUI/output. Absolute paths are supported. | |
| filename_prefix | STRING | ComfyUI | — |
| format | COMBO | flac | 3 options: flac, mp3, opus |
| quality | COMBO | 128k | 6 options: V0, 64k, 96k, 128k, 192k, 320k |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| audio | AUDIO | — |
| length | FLOAT | — |