Tensor → Audio
Turning raw audio tensors into AUDIO ComfyUI can save
- audio_tensor
- audio
Here's the problem with a raw audio tensor: it's just numbers. No sample rate, no metadata, no way for ComfyUI's standard nodes to know how to play it back. Tensor → Audio (class TensorToAudio) is the return half of the ComfyUI-AudioBridge pair - you use Audio → Tensor to feed audio into a MuseTalk-KJ or VoiceCraft node, and this node wraps whatever raw tensor comes out back into ComfyUI's native AUDIO type so the rest of your graph can handle it.
You reach for it after a talking-head or TTS step has done its thing. The sampler spits out a VCAUDIOTENSOR; without this node it dead-ends there. With it, you get a proper AUDIO you can pipe into a save or preview node, or onward into an editing chain.
How it works
It's deliberately dumb, which is the point. It checks the tensor's shape and pads it up to the (batch, channels, samples) layout ComfyUI's AUDIO expects - a 1D tensor gets two unsqueeze calls, a 2D one gets one. Then it wraps everything in the standard {"waveform": tensor, "sample_rate": sample_rate} dict and hands it back. No resampling, no audio processing. Read the source: roughly ten lines.
The inputs and outputs that matter
Two inputs, one of which is a trap for newcomers:
- audio_tensor (
VCAUDIOTENSOR) - the raw waveform from your MuseTalk/VoiceCraft/TTS node. - sample_rate (
INT, default16000, range 8000–48000) - this is where it bites. This node does not resample, it just labels the tensor with whatever rate you enter. Set it wrong and your audio plays at the wrong speed and pitch when you finally listen to it. If you fed audio in at 16 kHz on the Audio → Tensor side, match it here. The defaults already agree at 16000; don't drift.
Output:
- audio (
AUDIO) - a standard ComfyUI audio dict, ready for any node that accepts the native type.
Installing it
Same as its sibling - it ships in the same pack, so you get both at once. Via ComfyUI Manager, search ComfyUI-AudioBridge, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/RyanHolanda/ComfyUI-AudioBridge.git
The only dependency is torchaudio, already bundled with ComfyUI. No model downloads anywhere.
Where people get burned
The sample-rate trap above is the big one - it's a "garbage in, garbage out" labeling node, and nothing will tell you the label is wrong until you hear the chipmunk version. The other thing to keep straight is the asymmetry between the two pack nodes: Audio → Tensor actively resamples and downmixes to mono, while this one just reshapes and labels. It's the correct pair for the MuseTalk round-trip, but don't expect it to fix an audio-quality problem on the way back out - what the tensor is, is what you get.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| audio_tensor | VCAUDIOTENSOR | — | |
| sample_rate | INT | 160008000–48000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| audio | AUDIO | — |