Universal Audio Unpack
Trimmed, time-stretched, and ready to wire
- media_data
- audio
- sample_rate
- duration
- orig_duration
- trim_start
- trim_end
- channels
- filename
Audio is the forgotten half of most ComfyUI media workflows - everyone loads images and video, nobody thinks about the soundtrack until they need it. UniversalAudioUnpack fixes that. Wire it to a UniversalMediaLoader that has an audio file or a video file dropped on it, and it hands you the trimmed, optionally time-stretched audio as a proper ComfyUI AUDIO dict, ready for PreviewAudio, SaveAudio, or anything that consumes audio conditioning.
How it works
The node reads the MEDIA_DATA JSON the loader produces, finds the file, and decodes it with a graceful fallback chain: torchaudio first, then soundfile, then PyAV - whichever your install happens to have. Then it does three things:
- Trims to the
trim_start/trim_endseconds you set on the loader's waveform timeline, sample-accurately. - Time-stretches if you turned on playback speed in the loader. Speed runs from 0.10x to 4.00x, and it's a real time-stretch with pitch preserved - implemented via FFmpeg's
atempofilter, which is why the pack's only outside-binary dependency appears here. - Packages the result into the
{"waveform", "sample_rate"}dictionary ComfyUI'sAUDIOtype expects.
Because it accepts MEDIA_DATA from video too, you can pull the soundtrack out of an MP4 and use it separately while UniversalVideoUnpack handles the frames. The two nodes read the same trim values, so the audio you get lines up with the frames you get.
The outputs
audio- theAUDIOdict. This is the one you wire into preview/save or conditioning.sample_rate- e.g. 44100. Useful if you're building audio processing chains that need to know.duration- the trimmed/time-stretched length in seconds.orig_durationis the source file's full length.trim_start/trim_end- the boundaries actually used, in seconds.channels- how many channels survived decode.filename- the source file name.
Installing
Same pack, same drill: ComfyUI Manager (search "Universal Media Loader") or:
cd ComfyUI/custom_nodes/
git clone https://github.com/Fictiverse/ComfyUI_UniversalMediaLoader.git
Restart ComfyUI. No extra Python deps and no models.
Gotchas worth knowing
- The speed feature needs FFmpeg. The pack grabs the copy
imageio-ffmpegbundles with ComfyUI, or a systemffmpegif you have one. If neither exists, time-stretch silently gives up and returns the audio unchanged with a console warning - yourdurationwill then disagree with the speed you set. If you care about speed, make sureffmpegis findable. - Feed it image or canvas
media_dataand you get a silent zero-length placeholder, not an error. Not a bug - the pack's way of keeping every unpack robust to whatever the loader was holding. If your audio output looks "empty," check what's actually dropped on the loader. - Trimming is applied sample-accurately server-side, but the loader's 1-second magnet snap on the timeline is a UI nicety - toggle it off if you need finer boundaries.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| media_dataopt | MEDIA_DATA | — |
Outputs (8)
| Name | Type | Description |
|---|---|---|
| audio | AUDIO | — |
| sample_rate | INT | — |
| duration | FLOAT | — |
| orig_duration | FLOAT | — |
| trim_start | FLOAT | — |
| trim_end | FLOAT | — |
| channels | INT | — |
| filename | STRING | — |