Nodes/ComfyUI-UniversalToolkit/Load Audio Plus From Path (UTK)
ComfyUI Node

Load Audio Plus From Path (UTK)

Load audio from any path and trim, resample, and gain it on the way in

By whmc76·Created about a year ago·Updated 2 months ago· 72
Load Audio Plus From Path (UTK)
    • audio
    • sample_rate
    • channels
    • duration
    path./audio.mp3
    gain_db0.00
    offset_seconds0.00
    duration_seconds0.00
    resample_to_hz0.00
    make_stereotrue

    ComfyUI's built-in audio loader is a file-picker widget, which is fine until you want to script a batch, point at a path from a text node, or process the same file repeatedly. Load Audio Plus From Path (UTK) takes a plain filesystem path and loads audio from it - and does the preprocessing on the way in. Gain, offset, duration, resample, stereo conversion. It's the "plus" in the name, and it's why this is the audio input node from ComfyUI-UniversalToolkit I'd default to for any real audio pipeline.

    The pack's audio tree is one of the less common ones in the ComfyUI world, so this node quietly covers a gap most people don't realize exists until they need it.

    How it works

    It uses librosa for the heavy lifting and soundfile for the file I/O, loading whatever you point at (mp3, wav, flac, and friends). The path is cleaned up first - quotes stripped, backslashes normalized to forward slashes, so a Windows path pasted from Explorer works without surgery. Then it applies the processing chain in order:

    • offset_seconds - skip this much in.
    • duration_seconds - only keep this much (0 means "the whole file," which is the convention to remember).
    • gain_db - volume in decibels, converted via the standard 10^(db/20) math. −100 to +100, 0 = unchanged.
    • resample_to_hz - change the sample rate; 0 means leave it alone.
    • make_stereo - force two channels if the source is mono.

    Then it returns the audio in the standard ComfyUI AUDIO format plus the sample_rate, channels, and duration as plain numbers, which are handy for downstream scheduling or display.

    One smart detail: the node keys its IS_CHANGED on the file's modification time. Touch the file on disk and ComfyUI automatically re-runs the pipeline without you having to mute/unmute the node to force it.

    Inputs and outputs

    • path (STRING, default ./audio.mp3) - the file path.
    • gain_db, offset_seconds, duration_seconds, resample_to_hz, make_stereo - the processing chain.

    Outputs: audio (AUDIO), sample_rate (INT), channels (INT), duration (FLOAT).

    Install and gotchas

    Install via ComfyUI Manager (search "ComfyUI-UniversalToolkit") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/whmc76/ComfyUI-UniversalToolkit
    pip install -r requirements.txt
    

    Restart ComfyUI. No models. This node does need the audio dependencies - librosa, torchaudio, soundfile are all in the pack's requirements.txt, and the pack's loader wraps the audio module in a try/except, so if librosa is missing you won't get a loud error, just no audio nodes. That silent-missing-node failure is the classic way this pack bites; if audio nodes are absent after install, pip install -r requirements.txt didn't complete.

    Other gotchas: duration_seconds: 0 means "everything," which is counterintuitive - set it to 0 and you get the full file. And path errors are the number-one support question: the node validates the file exists and gives you a detailed message, but it can't read your mind about absolute vs relative paths. ./audio.mp3 resolves relative to where ComfyUI was launched, so an absolute path is the safer habit.

    CategoryUniversalToolkit/Audio

    Inputs (6)

    NameTypeDefaultDescription
    pathSTRING./audio.mp3
    gain_dbFLOAT0.00-100–100
    offset_secondsFLOAT0.000–100000000000000000
    duration_secondsFLOAT0.000–100000000000000000
    resample_to_hzFLOAT0.000–100000000000000000
    make_stereoBOOLEANtrue

    Outputs (4)

    NameTypeDescription
    audioAUDIO
    sample_rateINT
    channelsINT
    durationFLOAT