Nodes/ComfyUI-PainterNodes/Painter Audio Upload
ComfyUI Node

Painter Audio Upload

Feed a lip-sync a real audio file without leaving the graph

By princepainter·Created 7 months ago·Updated 2 days ago· 190
Painter Audio Upload
    • audio
    audio_filename
    trim_start0.00
    trim_end-1.00

    If you've ever built a talking-head or audio-driven-video workflow, you know the awkward part isn't the model - it's getting a clip of speech into the graph as an AUDIO tensor, and then re-cutting it every time you decide the take is 0.3 seconds too slow. PainterAudioUpload is the input node from princepainter's ComfyUI-PainterNodes pack that handles that inside the node, no Audacity trip required. Upload a file or record straight from your browser mic, see the waveform, drag-select the region you want, and pipe the trimmed audio into the pack's lip-sync and audio-to-video nodes.

    That's the context you should slot it into. PainterNodes is a Chinese-authored, free-and-open grab bag of image and video generation nodes: audio-driven image-to-video and video-to-video, Wan 2.2 + LTX 2.3 combos that add a voice track to a silent clip (PainterV2AV, PainterLTX2Vomni), plus Humo and S2V lip sync. All of those eat an AUDIO input, and this node is the "in" end of that chain. Think of it as the first step in a talking-head pipeline: a TTS output or a recorded voice lands here, gets trimmed, and becomes the driver for the mouth. Nothing about it generates audio - it just gets you from a file to a clean AUDIO tensor.

    How it works

    Don't overthink the mechanism - it's a loader with a genuinely nice browser widget. The Python side keeps three plain widgets (audio_filename, trim_start, trim_end) that the front-end JS visually collapses so they don't clutter the node; all the real interaction happens in the widget itself, which draws the waveform, handles playback, and manages the mic recorder.

    When the graph runs, the node resolves the file from ComfyUI's input directory, decodes it with torchaudio, and falls back to soundfile if torchaudio isn't importable - a thoughtful touch for lean installs. It returns the standard ComfyUI AUDIO format, a dict of waveform tensor plus sample_rate. Trimming is applied to the tensor at execution time, so the original file on disk is never modified. It also keys its change-detection off the filename plus trim values, so re-running actually picks up a new file or a new selection instead of serving you a cached result.

    The inputs you'll actually set

    Three inputs, and you'll touch roughly one of them by hand:

    • audio_filename - set automatically when you upload or record through the widget. Leave it alone.
    • trim_start - where to start, in seconds. Default 0.
    • trim_end - where to stop, in seconds. Default -1, which means "through the end of the file."

    The real controls are the upload and microphone buttons and the drag-select on the waveform; the trim numbers are just the values those interactions write into the hidden widgets.

    The single output, audio (type AUDIO), wires into anything that accepts AUDIO - a preview or save node if you want to check your work, or the pack's own audio-driven-video nodes for the actual lip-sync.

    Installing it

    The easy route is ComfyUI Manager: search "PainterNodes" and hit install. Manually, it's the standard dance:

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

    Then restart ComfyUI. The dependencies are light - the pack's requirements.txt pins only soundfile>=0.12.1 and numpy>=1.21.0. No model downloads, no API keys, nothing GPU-heavy just to get audio in.

    Gotchas

    The one error you'll actually hit is "trim range is set but no audio file is associated." That happens when you save a workflow, the trim values stick around, but the file reference gets lost. The node's own error message tells you the fix, which is refreshingly honest: right-click the node, choose "Clear audio," and re-upload.

    Two other things to keep in mind. Files you load live in ComfyUI's input directory - if you move or delete them from disk, the node raises a file-not-found and you'll be confused for a minute. And because this pack is a fast-moving one-person project, the README and changelog are written mostly in Chinese; English documentation is thin, so if you need hand-holding, this isn't where you'll find it. Small trade for a node that saves you a trip to an audio editor on every single take.

    Categoryaudio/input

    Inputs (3)

    NameTypeDefaultDescription
    audio_filenameSTRING
    trim_startFLOAT0.000–99999
    trim_endFLOAT-1.00-1–99999

    Outputs (1)

    NameTypeDescription
    audioAUDIO