Nodes/Pitch Mask Fallback/Pitch MMAudio Sampler
ComfyUI Node

Pitch MMAudio Sampler

Give it frames (or just a prompt) — get back audio matched to your video

By pitch7900·Created 7 months ago·Updated 7 months ago· 0
Pitch MMAudio Sampler
  • mmaudio_model
  • feature_utils
  • images
  • audio
duration8.00
steps25
cfg4.5
seed0
prompt
negative_prompt
mask_away_clipfalse
force_offloadtrue

PitchMMAudioSampler is where the MMAudio chain actually pays off: it takes the model from PitchMMAudioModelLoader, the conditioning stack from PitchMMAudioFeatureUtilsLoader, and your words - and optionally your video frames - and produces audio. Wire the AUDIO output to a save node and you have foley for a silent Wan or Hunyuan render, the classic job MMAudio exists for. It's a flow-matching sampler, so the mental model is closer to a KSampler than to any image node you know: prompt, steps, CFG, seed, generate.

How it works

The sampler runs a flow-matching Euler scheduler over the steps you set, with text as the required conditioning. The interesting twist is the optional images input (IMAGE): feed it your video frames and the node encodes them two ways - a CLIP pass at 384px and a Synchformer sync pass at 224px - and uses both to steer the audio so it matches what's on screen. Leave images unplugged and it generates pure text-to-audio with empty video conditioning instead. The one input beginners actually reach for:

  • prompt - what the audio is. "A spaceship engine humming in deep space," "rain on a tin roof." This is the steering wheel.
  • negative_prompt - what it shouldn't be. Loose but useful.
  • duration (FLOAT, default 8s) - how long the clip is. The tooltip says it plainly: duration in seconds.
  • steps (INT, default 25) - sampler steps. More steps, cleaner audio, slower.
  • cfg (FLOAT, default 4.5) - conditioning strength. The tooltip's words: strength of the conditioning.
  • seed - set it and lock it to reproduce a take.
  • mask_away_clip (BOOLEAN, default off) - if on, the video conditioning is discarded and it's text-only, even with frames wired in.
  • force_offload (BOOLEAN, default on) - after sampling, the models get pushed off the GPU. Leave it on unless you're chaining generations back-to-back and want the speed.

Output: audio (AUDIO) - a waveform tensor plus a 44100 Hz sample rate, ready for ComfyUI's audio save/playback nodes.

Installing it

Same pack as the rest of the chain: pitch7900/ComfyUI-PitchCustomNodes. Install via ComfyUI Manager (search "Pitch Mask Fallback") or:

cd ComfyUI/custom_nodes
git clone https://github.com/pitch7900/ComfyUI-PitchCustomNodes

Restart, then load the models into ComfyUI/models/mmaudio - the MMAudio checkpoint, VAE, Synchformer, and CLIP. In 44k mode the NVIDIA vocoder auto-downloads on first run; 16k mode needs PitchMMAudioVoCoderLoader wired in. Dependencies (accelerate, open_clip_torch, huggingface_hub, omegaconf, einops) install with the pack. The README is empty, so the source is your only doc - but the defaults are sane, so you can mostly just click generate.

Common issues

  • No video conditioning applied. Either images isn't wired, or mask_away_clip is on. Both are easy to miss, and the result is audio that ignores the visuals.
  • Audio shorter than you asked. The node silently truncates duration if your input video has fewer frames than the requested length - there's a console warning about it. Match your frame count to your duration or you'll get a shorter clip.
  • "AttributeError: seq_cfg" on the model - the 44k/16k filename gotcha from the model loader. Keep 16 or 44 in the checkpoint filename.
  • Old-torch errors ("torch.nn has no attribute Buffer") are the underlying MMAudio code fighting an old torch. Update ComfyUI's torch.

The honest verdict: the pack is rough around the edges - empty README, filename quirks - but this sampler is the working core of a real foley pipeline, and the defaults are good enough that your first successful render is a text prompt and one click away.

CategoryPitch/Audio

Inputs (11)

NameTypeDefaultDescription
mmaudio_modelMMAUDIO_MODEL
feature_utilsMMAUDIO_FEATUREUTILS
durationFLOAT8.00Duration of the audio in seconds
stepsINT25Number of steps to interpolate
cfgFLOAT4.5Strength of the conditioning
seedINT00–18446744073709550000
promptSTRING
negative_promptSTRING
mask_away_clipBOOLEANfalseIf true, the clip video will be masked away
force_offloadBOOLEANtrueIf true, the model will be offloaded to the offload device
imagesoptIMAGE

Outputs (1)

NameTypeDescription
audioAUDIO