Nodes/ComfyUI-TD/AudiotoTD
ComfyUI Node

AudiotoTD

Ship audio out of ComfyUI into TouchDesigner without ever touching a file

By JiSenHua·Created 2 years ago·Updated 12 days ago· 164
AudiotoTD
  • audio
    broadcastfalse

    AudiotoTD is the audio end of the ComfyUI-TD pack: a terminal node that takes an AUDIO stream from your graph and pushes it over WebSocket into TouchDesigner, where the pack's ComfyUI2TD.tox component turns it into an audio CHOP you can wire straight into speakers, an FFT analysis, or audio-reactive visuals.

    Why would you reach for it? If you're building a realtime setup - a VJ rig, an interactive installation, a generative show - the whole point of this pack is that ComfyUI and TouchDesigner talk while you work, not after you save. Instead of generating audio, writing an mp3, and importing it into TD, you just let the node hand the samples over live. It's the same pattern as ImagetoTD but for sound: no files, no polling, no manual sync step.

    How it works

    ComfyUI's AUDIO socket carries a dict of a waveform tensor plus a sample rate. AudiotoTD grabs that, normalizes the waveform so you don't clip on the way out, then encodes it into one of two formats:

    • wav - lossless PCM-16, written with soundfile. Bigger payload, perfect fidelity.
    • mp3 - encoded with the ffmpeg binary bundled with imageio-ffmpeg at whatever bitrate you set. Much smaller over the wire, at a fidelity cost.

    The encoded bytes are pushed over ComfyUI's binary WebSocket (a custom message type the tox listens for) and parsed into a CHOP on the TD side. You never see a file, and neither does TD - it's a stream.

    The inputs that matter

    It's an output node, so there are no sockets to wire onward - the "output" appears in TouchDesigner.

    • audio - the AUDIO socket from any upstream node that produces one.
    • format - wav or mp3. If your ComfyUI is remote or on a slow link, mp3 wins.
    • bitrate_kbps - 32–512, default 192. Only affects mp3; for realtime stuff you can go lower and save a lot of bandwidth.
    • broadcast - off by default, which means "send only to the client that queued the job." Flip it on when you have more than one WebSocket client and want everyone to get the stream.

    Install

    The pack installs like any other custom node. Easiest is ComfyUI Manager - search for ComfyUI-TD - or do it by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/JiSenHua/ComfyUI-TD.git
    

    Then restart ComfyUI. The pack's real dependencies (trimesh, imageio-ffmpeg, soundfile, plyfile) get pulled in by Manager automatically. The part people forget: this is only half the setup. You also need the ComfyUI2TD.tox component (it ships in the repo's tox folder), and it must be v5.1.x or newer - drag it into your TD project and it's what actually connects to ComfyUI and parses the stream.

    Gotchas

    The most common failure is "my node ran but TD shows nothing," and it's almost always one of three things: the tox version is old, the tox isn't pointed at the right ComfyUI WebSocket, or broadcast is off while the client that should receive the audio is a different one. One quirk worth knowing: the official video tutorials are in Chinese and hosted on Bilibili - they're good, just not in English. Start with a wav at default bitrate to confirm the path works, then switch to mp3 for anything bandwidth-sensitive.

    CategoryTouchDesigner

    Inputs (2)

    NameTypeDefaultDescription
    audioAUDIO
    broadcastBOOLEANfalse

    Outputs (0)

    No outputs