Resample Audio
Change sample rate without the quality hit of a naive resample
- audio
- audio
Changing a clip's sample rate sounds like it should be trivial, but a naive resample introduces audible artifacts - aliasing, ringing - if you don't filter correctly. This node wraps torchaudio's proper sinc-interpolation resampler, the same one most serious audio pipelines use, so you get a clean rate change instead of a degraded one.
How it works
This is a direct wrapper around torchaudio.transforms.Resample - every parameter here maps straight onto that transform's own arguments, which is worth knowing if you ever want to go read torchaudio's docs for more depth than a node tooltip can give you. It resamples via band-limited sinc interpolation, using a windowed-sinc filter (Hann or Kaiser) to avoid the aliasing you'd get from a naive nearest-neighbor or linear resample.
The inputs and outputs that matter
audio- the clip to resample, required.new_freq(default32000) - the target sample rate in Hz. If you're feeding output into Whisper or most speech models, you want 16000, not the default - 32kHz is a more general-audio-friendly default, not a speech-model one. Check what your downstream node actually expects.resampling_method-sinc_interp_hannorsinc_interp_kaiser, the two windowing functions torchaudio supports for the sinc filter. Hann is the simpler, faster default; Kaiser gives you more control over the passband/stopband tradeoff viarolloffandbetaat a bit more compute cost. Most people never need to leave Hann.lowpass_filter_width(default6) - how many zero-crossings the sinc filter spans; higher gives a sharper, more accurate filter at more compute cost. The default is a reasonable middle ground.rolloff(default0.99) - the filter's cutoff as a fraction of Nyquist; leave it near 1.0 unless you specifically want to roll off more aggressively.beta(optional, default ≈14.77) - only relevant whenresampling_methodissinc_interp_kaiser; it's the Kaiser window's shape parameter, and this default is torchaudio's own standard value. Ignored entirely on Hann.
How to install it
ComfyUI Manager: search ComfyUI-speech-dataset-toolkit, install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/kale4eat/ComfyUI-speech-dataset-toolkit
cd ComfyUI-speech-dataset-toolkit
pip install torchaudio --index-url https://download.pytorch.org/whl/cu121
pip install -r requirements.txt
No extras beyond the pack's standard torchaudio dependency - this node is basically torchaudio itself with a UI.
Common issues & troubleshooting
Whisper/ASR node downstream is producing garbage. Check new_freq first. Whisper-family models expect 16kHz input; if you left this at the 32000 default (or resampled from something that doesn't match what your transcription loader expects), that mismatch alone can tank accuracy even though nothing "errored."
Resample sounds subtly worse or smeared. Try bumping lowpass_filter_width up from the default, or switch to sinc_interp_kaiser for a sharper filter - the tradeoff is more compute per resample, which is negligible for anything but very long batch jobs.
Not sure what sample rate your input actually is. Run it through SDT_AudioProperty first - it reads the sample rate directly off the clip so you know what you're actually converting from before you set a target.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| audio | AUDIO | — | |
| new_freq | INT | 32000 | — |
| resampling_method | COMBO | 2 options: sinc_interp_hann, sinc_interp_kaiser | |
| lowpass_filter_width | INT | 60–4294967296 | — |
| rolloff | FLOAT | 0.99 | — |
| betaopt | FLOAT | 14.77 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| audio | AUDIO | — |