Nodes/ComfyUI-audio-speed/PT Audio Speed
ComfyUI Node

PT Audio Speed

Speed up audio for video sync — and get the exact frame count for free

By ptmaster·Created about a year ago·Updated 2 months ago· 15
PT Audio Speed
  • audio
  • audio
  • frame_info
speed_factor1.0
frame_rate23

PT Audio Speed is the reason this pack exists. Its author hit a genuinely annoying wall: doing voiceovers for video generation (their stack was FantasyTalking + Wan, Alibaba's open video family) where the video model runs at 23 FPS but they work in a 16 FPS pipeline. ComfyUI had no native way to change audio speed, so they built one and - like so many small ComfyUI tools - published it for everyone. It's a general-purpose audio speed node that also happens to print the frame math you need for audiovisual sync.

How it actually works (read this before setting the dial)

The name is honest, but the mechanism is not what most people assume. This is not a pitch-preserving time-stretch like WSOLA or a phase vocoder. It's a resample-and-relabel trick:

  • It resamples the waveform to original_rate × speed_factor with torchaudio's Resample.
  • Then it labels the result with the original sample rate.

Because the sample count changed but the playback rate didn't, the duration changes. speed_factor = 1.0 is a no-op. Below 1.0 the audio gets shorter and plays faster - pitch rises with it, tape-machine style. Above 1.0 it plays slower and droops. The README's own math makes this concrete: 0.7x is a 1.4x acceleration (1/0.7 ≈ 1.43). The author's framing is "speed up the audio to match the sampler, then import the original audio at final render."

The honest caveat: this shifts pitch along with speed. A voice at 1.4x sounds a bit chipmunk-y. That's fine for syncing narration to frames and then replacing it with the original in the final render (the author's whole workflow). It's wrong if you actually want pitch-preserved speed change for music. For that you want a proper time-stretch node, not this one.

The inputs that matter

There are only three, and only two really do anything:

  • audio - the AUDIO dict from any loader, TTS, or decode node.
  • speed_factor - FLOAT, 0.1–10, step 0.1. Remember the inversion: lower = faster. Set 0.7 for the classic ~1.4x acceleration, or 2.0 to slow to half speed.
  • frame_rate - INT, 12–120. This one never touches the audio. It only feeds the second output's math, so set it to your video's FPS and leave it.

The output that's actually clever

You get audio (wire it into your sampler or save node) and frame_info, a STRING. It's a text summary in the author's native language - something like 原始音频: 107 帧 (4.00s) | 输出音频: 154 帧 (7.00s) plus the FPS and speed factor. The numbers are what matter: the node computes how many frames your sped-up clip occupies at your chosen frame rate, so you can punch that straight into the video renderer's frame parameters instead of guessing. To see it, drop a text preview node on the frame_info output - the README points at "Preview Arbitrary" or "Display Anything" style nodes for exactly this.

Install

Same as any custom node. Via ComfyUI Manager, search ComfyUI-audio-speed, install, restart. Or the manual route:

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

Then restart ComfyUI. There's no requirements.txt - the only real dependency is torchaudio, which ships with the standard PyTorch install most ComfyUI setups already have. No model downloads, nothing to cache. If it fails to import, your venv is missing torchaudio; pip install torchaudio fixes it.

Gotchas worth knowing

  • The README says the node "defaults to 0.7x" - the shipped code defaults speed_factor to 1.0. Check your widget; the README describes the author's own usage, not the default you'll get.
  • The speed direction trips people up constantly. 0.7 is faster, 1.4 is slower. Think of it as "output duration multiplier," not "how fast the playback feels."
  • The frame_info string is just text - it won't display unless you wire it to a text/preview node.
  • This is a tiny personal pack (one Python file, no CI, even some test FLACs committed to the repo) with essentially zero community footprint. ComfyUI custom nodes run arbitrary code, so if you're cautious, skim PTSpeedaudio.py before trusting it - it's ~200 lines and readable.
Categoryaudio/processing

Inputs (3)

NameTypeDefaultDescription
audioAUDIO
speed_factorFLOAT1.00.1–10
frame_rateINT2312–120

Outputs (2)

NameTypeDescription
audioAUDIO
frame_infoSTRING