ComfyUI Node

WaveformDevice

Move an audio waveform between CPU and GPU with a switch

By Fictiverse·Created 3 years ago·Updated 24 days ago· 27
WaveformDevice
  • audio
  • audio
switch_tofalse

Every now and then your audio pipeline throws a device mismatch: one node hands you a waveform living on CUDA, and the next node only works on CPU - or the reverse. WaveformDevice is the adapter for exactly that moment. It takes an AUDIO object, moves its waveform tensor between CPU and GPU according to a boolean, and hands the audio back. Nothing more, nothing less.

You won't reach for this every day, but when you need it, you really need it. ComfyUI's audio nodes mix the two worlds constantly: GPU-accelerated stuff like audio-conditioned generation and VAEs wants tensors on CUDA, while CPU-bound filters and utilities often break if you feed them GPU tensors. A single inline node that flips the device is the difference between a working chain and an opaque expected device cpu error halfway through a video-plus-audio workflow. Drop it between the producer and the consumer, set the switch once, done.

How it works

It validates that the input is a proper ComfyUI AUDIO - a dict holding a waveform tensor and a sample_rate - then moves the waveform with a standard .to(device) call. The switch_to boolean chooses the target: True tries CUDA, and False goes to CPU. The sensible safety net is built in: if you ask for GPU but CUDA isn't available, it falls back to CPU rather than crashing. It rebuilds the audio dict with the same sample rate and returns it.

Inputs and outputs

  • audio (AUDIO) - any ComfyUI audio object: waveform tensor plus sample rate.
  • switch_to (BOOLEAN) - True pushes to GPU, False to CPU. The UI labels it as "GPU (CUDA) 🚀 / CPU 🖥️" so the intent is unambiguous.
  • audio (AUDIO) - the same audio, on the requested device.

Wire it inline: audio source → WaveformDevice → audio consumer. Because it returns the full AUDIO object, you can drop it in without changing anything else in the chain.

Installing it

Part of ComfyUI Fictiverse Nodes, a small single-author pack with no Python dependencies beyond ComfyUI's own stack and no models to download.

  • ComfyUI Manager → search ComfyUI Fictiverse Nodes → Install, restart.
  • Or: cd ComfyUI/custom_nodes && git clone https://github.com/Fictiverse/ComfyUI_Fictiverse, restart.

Common issues

The failure mode to know: the node insists on a real AUDIO dict and raises a TypeError if you hand it something else, and it will only move a PyTorch tensor. Most ComfyUI audio comes in the right shape, but if you're feeding it a bare array or a custom audio format from a less-standard pack, it'll refuse loudly - which is better than silently corrupting. Also remember it's a device mover, not a converter: it changes where the data lives, never the audio itself, so don't expect resampling or format changes.

And the standard pack warning: Fictiverse nodes ride along in shared workflows, so if you load one without the pack installed you'll hit ModuleNotFoundError: No module named 'custom_nodes.ComfyUI_Fictiverse'. Install the pack and restart - that's the fix, not a code problem.

CategoryFictiverse/Audio

Inputs (2)

NameTypeDefaultDescription
audioAUDIO
switch_toBOOLEANfalse

Outputs (1)

NameTypeDescription
audioAUDIO