Nodes/ComfyUI-Audio-Pitch/Audio Pitch (Mono)
ComfyUI Node

Audio Pitch (Mono)

The Pitch Node That Won't Eat Your RAM

By Takenoko3333·Created 10 months ago·Updated 9 months ago· 1
Audio Pitch (Mono)
  • audio
  • audio
n_steps0
bins_per_octave12
n_fft1024
win_length-1
hop_length-1

Audio Pitch (Mono) is one of those nodes that exists because something in the ComfyUI ecosystem annoyed someone enough to fix it. The "something" here is torchaudio's PitchShift, which - per the author - leaks memory when you feed it MMAudio output and re-run the graph. This node is the fix: it shifts pitch on pure CPU, drops torchaudio entirely, and is shaped specifically to sit at the end of an MMAudio foley chain without your RAM creeping upward across runs.

Why you'd reach for it

The standard foley setup in ComfyUI is video model → MMAudio, the flow-matching workhorse people bolt onto a Wan or Hunyuan render to get matching sound. Once you have that generated audio, the next question is usually "can I make it lower / higher / spookier?" - deepen a footstep, brighten a sound effect, transpose a synth. That's pitch shifting, and most options in the ecosystem lean on torchaudio's PitchShift to do it. This pack is a fork of audio-general-comfyui (still MIT) that ripped that dependency out and reimplemented the shift by hand.

How it works

It's a phase vocoder, the classic way to change pitch without changing duration. The audio goes through an STFT with a Hann window; each frequency bin's phase is propagated frame-to-frame with a phase-unwrapping correction (dphase folded back into ±π so the oscillator stays coherent), then it's reassembled via ISTFT and linearly resampled back to the original length.

The math is simple once you see it: r = 2^(n_steps / bins_per_octave). The node time-stretches by 1/r, then resamples to the original sample count, so the duration stays put and the pitch moves. Set n_steps to 12 and you get +1 octave; −24 to +24 is the range, roughly two octaves each way. Set it to 0 and the whole thing bypasses - it just reshapes the tensor and returns your audio untouched.

One honest expectation before you get excited: this is a phase-vocoder shift, so formants move with the pitch. Pitch a voice up and it gets chipmunk, not "tall opera singer." That's the technique, not a bug - if you need formant-preserving shift, this isn't that tool.

Inputs and outputs

Only one of these will actually become part of your routine:

  • audio (AUDIO) - the input. Wire in whatever outputs AUDIO: LoadAudio, MMAudio, a VHS node's audio. Gotcha: it forces mono and, if you feed it stereo, quietly takes the first channel. Don't build a stereo pipeline around this.
  • n_steps (INT, default 0) - semitone shift, −24 to +24. This is the knob you turn.
  • n_fft (INT, default 1024) - FFT size. Larger is smoother but heavier; 1024 is the author's tuned default for short clips. bins_per_octave (default 12), win_length, and hop_length (both default −1, meaning "derive from n_fft") are there if you're tuning, but you can leave them alone.

It has a single output, audio (AUDIO), which wires straight into PreviewAudio, SaveAudio, or a video node's audio input. The bundled sample workflow is just LoadAudio → Audio Pitch (Mono) → PreviewAudio; you'll find it as "audio-pitch-sample" by searching "pitch" in the ComfyUI templates, or in the pack's example_workflows folder.

Installing it

Either route works; there are no models to download and no heavy dependencies - requirements.txt is effectively empty because it only uses the torch ComfyUI already ships.

cd ComfyUI/custom_nodes
git clone https://github.com/Takenoko3333/comfyui-audio-pitch.git

Then restart ComfyUI. Or just search "Audio Pitch" in ComfyUI Manager and let it handle it.

Common issues

  • Nothing changes when you run it. Your n_steps is still 0, which is bypass mode. Set it and re-run.
  • It's slow on long audio. Pure CPU, and the phase accumulator loops over output frames in Python. Great for a two-second foley hit, painful for a ten-minute track.
  • Your stereo turned into mono. By design, as above.
  • n_steps=0 producing identical output is expected, not broken - that's the bypass feature working.

Small pack, narrow job: CPU pitch shifting for MMAudio-era foley without RAM creep. If you need stereo or formant-preserving quality, shop elsewhere - for quickly transposing a generated sound effect, this is exactly the right amount of tool.

CategoryAudioPitch

Inputs (6)

NameTypeDefaultDescription
audioAUDIO
n_stepsINT0-24–24Semitone shift (−24 to +24 ≈ ±2 octaves).
bins_per_octaveoptINT12The number of steps per octave (Default : 12).
n_fftoptINT1024Size of FFT, creates n_fft // 2 + 1 bins (Default: 1024). Larger = smoother, but heavier.
win_lengthoptINT-1Window size. If -1, then n_fft is used
hop_lengthoptINT-1Length of hop between STFT windows. If None, then win_length // 4 is used

Outputs (1)

NameTypeDescription
audioAUDIO