Nodes/ComfyUi-MpiNodes/Mpi Load Audio Upload
ComfyUI Node

Mpi Load Audio Upload

Pulling sound into a graph that keeps losing it

By MadPonyInteractive·Created 11 months ago·Updated 2 days ago· 3
Mpi Load Audio Upload
    • audio
    • loaded
    audio
    block_if_emptytrue
    string

    Audio in ComfyUI is the part everyone forgets until the render comes back silent. The built-in Load Audio works, but it wants the file already inside ComfyUI's input/ folder, and it gives you no way to tell that a load failed - you find out three nodes later when something downstream gets a waveform of nothing.

    Mpi Load Audio Upload is the audio loader with the practical bits attached: a file picker with a choose file to upload button and drag-and-drop, a player so you can hear what you're about to feed the model, a string field for path-driven or app-injected loading, and a loaded boolean. It also pulls the soundtrack out of video files, which is the trick that makes it more than a convenience node.

    What it does under the hood

    First it asks whether there's any audio at all. The file is probed with ffmpeg for an Audio: stream line before anything is decoded, because "this video has no soundtrack" and "this video has a silent soundtrack" should not look the same to your graph. If there's no audio, loaded is false and you get either a block or silent audio depending on block_if_empty - not a fake track.

    If there is audio, ffmpeg strips the video (-vn) and writes 16-bit PCM to a temp WAV, read back with Python's stdlib wave module into the standard AUDIO object: {"waveform": [1, channels, samples], "sample_rate": ...}. Anything that takes audio takes this.

    The player widget is the one part you wouldn't expect in a node pack. ComfyUI's frontend attaches its upload button to any node with a required audio combo, but only wires up the audio player for its own nodes - so this pack ships a small JS extension that declares the player. It's declarations only; the upload itself is done by the core frontend, which is why drag-and-drop behaves exactly like the built-in loader.

    Inputs and outputs

    audio is the picker and defaults to None, so a freshly added node loads nothing until you tell it to. block_if_empty (default on) decides the failure behaviour: on, a missing or audio-less file blocks the whole downstream branch; off, you get silent audio so the graph keeps going. The optional string is a filename inside input/ (subfolder included) that's tried first - empty or unloadable, it falls back to the picker. That ordering is there so an app can inject the file into a saved workflow with the picker left on None.

    Two outputs: audio, which goes anywhere an AUDIO input exists - a save-video node's audio slot, a CreateVideo, an audio VAE encode, a lip-sync or audio-driven generation model - and loaded, which is true only when audio was actually read and is never blocked. That second property is what makes it useful: in the blocked case the audio wire is dead, but loaded still flows, so you can gate a fallback branch or a warning in the same graph instead of a run that dies with no output.

    If you're doing windowed work on an audio-video model, the pack's own range and splice nodes take the same inclusive frame numbers as the video side, which saves you from cutting one stream and leaving the other whole.

    Installing it

    Search ComfyUi-MpiNodes in Custom Nodes Manager (it's on the Comfy Registry under publisher mad-pony-interactive), or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/MadPonyInteractive/ComfyUi-MpiNodes
    

    Restart afterwards. No pip install needed - the pack has no requirements.txt, and the audio path only needs a stdlib WAV reader plus ffmpeg. Which brings us to:

    Where people get tripped up

    No ffmpeg means a silent no-op, not an error. The pack looks for an ffmpeg in three places: VHS_FORCE_FFMPEG_PATH, then the binary bundled by imageio-ffmpeg (the one VideoHelperSuite brings in), then your PATH. Find none and this node simply reports nothing loaded - indistinguishable from a wrong filename. If audio loads suddenly stopped working after a fresh install, that's your first suspect; installing VideoHelperSuite or setting VHS_FORCE_FFMPEG_PATH fixes it.

    Paths are contained to ComfyUI's own folders. A filename resolves under input/, and an absolute path is only accepted if it already sits inside input/, output/ or temp/. An absolute path anywhere else is treated as missing, silently. Drop the file into input/ or upload it through the node.

    The picker only lists loose files in input/. Files nested in subfolders don't appear in the drop-down, but typing the relative path - sub/take.wav - works fine.

    A video with no audio track is a failed load, not an empty one. With block_if_empty on, that block will travel further than you expect; if you're loading clips of unknown provenance, either turn it off or branch on loaded.

    CategoryMpiNodes/Video

    Inputs (3)

    NameTypeDefaultDescription
    audioCOMBOPick an audio (or video) file, or use the upload button / drag-and-drop; the file is uploaded into ComfyUI's input/ folder. Used when string is empty or does not load; None picks nothing.
    block_if_emptyBOOLEANtrueON: empty/missing/audio-less path blocks downstream execution. OFF: outputs silent audio so the graph continues.
    stringoptSTRINGFile name inside ComfyUI's input/ folder, with its subfolder if it has one (an absolute path must be inside input/, output/ or temp/). Tried first; if it is empty or does not load, the picker is tried. Nothing loads only when both fail (picker on None).

    Outputs (2)

    NameTypeDescription
    audioAUDIO
    loadedBOOLEAN