Audio Resampler
Audio Resampler — speak the sample rate the next node wants to hear
- audio
- audio_out
Sample rate is the quiet metadata that ruins everything. A video track wants 48 kHz, your generated voice is 22.05 kHz, and the mismatch shows up as speeded-up, chipmunk audio or a hard failure the moment you try to combine them. Audio Resampler (SET_AudioResampler) is the tiny node that reconciles rates, and it's as boring and essential as that job sounds.
The input
One real input that matters: target_sample_rate, in Hz. 44100 (CD), 48000 (video standard), 22050, 16000 (speech/TTS/ASR territory), whatever your downstream wants. Set it to 0 and the node is a no-op - it keeps the file's original rate. That 0-as-"unchanged" convention is worth remembering because it appears all over this pack (Channel Conv and Resampler, Download and Load all use it).
Under the hood it uses torchaudio.transforms.Resample, the standard, well-tested resampler that ComfyUI's own audio stack relies on - no custom DSP, no surprises. The output audio_out preserves batch size and channel count; this node only touches the rate.
Why you'll care
- Batching consistency. When you Batch Audios two clips at different rates, the whole batch snaps to
audio1's rate silently. If you want the other rate to win, resampleaudio1first, or resample both inputs to the same rate before batching and take the ambiguity out entirely. - Downstream requirements. Speech models want 16 kHz; video pipelines usually want 48 kHz. Feed them what they ask for and the errors stop.
- File size / efficiency. Lower sample rates mean fewer samples, which means faster processing on heavy audio graphs. Not a reason to go below what you need, but a reason to not run everything at 48k when your content is a voice.
Resampling is also genuinely lossy the first time - it can't invent frequencies above the new Nyquist limit, and quality depends on the algorithm. torchaudio's Resample is good, but don't bounce a file between rates repeatedly and expect a pristine result. Resample once, near the end of the chain.
Install & gotchas
It ships in the Audio Batch pack. ComfyUI Manager search "Audio Batch", or:
cd ComfyUI/custom_nodes/
git clone https://github.com/set-soft/ComfyUI-AudioBatch
pip install seconohe
Restart ComfyUI. No model downloads, and torchaudio already ships with ComfyUI.
The gotcha, again, is the 0 default: it means "don't resample," so the node does nothing until you type a rate. A workflow that's "supposed to resample" but passes audio through untouched is almost always this. And if you ever see the resampler produce a shorter clip than expected, that's just the sample count recalculating at the new rate - duration in seconds stays the same, the sample count does not.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| audio | AUDIO | — | |
| target_sample_rate | INT | 00–192000 | Output sample rate, 0 is same as input |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| audio_out | AUDIO | — |