Nodes/ComfyUI-audio-speed/PT 48kHz Resampler
ComfyUI Node

PT 48kHz Resampler

The 48kHz resampler that fixes 'these two audios won't merge'

By ptmaster·Created about a year ago·Updated 2 months ago· 15
PT 48kHz Resampler
  • audio
  • audio

PT 48kHz Resampler exists because of one very specific ComfyUI headache, and the author states it plainly in the README: sample rates across ComfyUI audio aren't uniform, and directly merging audio at different sample rates causes errors. This node is the blunt fix - normalize everything to 48 kHz before anything downstream tries to mix it.

What it does

One input, one output. Feed it any AUDIO dict:

  • Already at 48000 Hz? It passes through untouched.
  • Anything else (44.1 kHz is the usual suspect, but 16/22.05/32 kHz show up too)? It resamples to 48000 Hz using torchaudio's Resample.

The resampler is created lazily and cached per node instance, so the first run pays the cost and re-runs are cheap. The output audio carries sample_rate = 48000 plus a small conversion_info field describing what happened, so downstream nodes can see the actual rate.

There are no knobs here - no quality selector, no target-rate option. It does 48 kHz, full stop. If you need 44.1 kHz or something arbitrary, this isn't your node; it's a single-purpose normalization gate.

Where it belongs in a workflow

Think of it as the front-door guard for any chain that ends in merging or mixing audio. Typical placement: right after each audio source (a TTS node, a VAE decode, a loaded clip) and before the node that combines them. Slap it on every source that might disagree, and the merge stops complaining. It pairs naturally with its sibling PT Ensure Stereo - normalize rate here, force stereo there, then combine.

One quirk: it's marked as an output node in the code, which just means ComfyUI will execute it even if nothing's wired below. Harmless, slightly unusual, and worth knowing if you're the type to notice that the node has a yellow output tag in the graph.

Install

Same as every node in this pack. ComfyUI Manager → search ComfyUI-audio-speed → install → restart. Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/ptmaster/comfyui-audio-speed

Then restart ComfyUI. No requirements.txt in the repo, no models to download - the only dependency is torchaudio, which comes with the standard PyTorch install your ComfyUI almost certainly already has. If the node errors on import, that's your missing piece: pip install torchaudio.

The honest caveat

This is a tiny utility from a personal repo (essentially zero community usage), and its entire job is one thing. If your problem is a different sample-rate target, or if you need resampling quality control, look elsewhere - ComfyUI's bigger audio packs like ComfyUI Music Tools give you rate conversion with actual options. For the narrow "just make it 48k so my merge stops erroring" case, this is exactly the ~40 lines of code you'd want.

Categoryaudio/processing

Inputs (1)

NameTypeDefaultDescription
audioAUDIO

Outputs (1)

NameTypeDescription
audioAUDIO