Nodes/ComfyUI-MiniMaxH3-Context-Loop/MiniMax H3 Chain Audio Refine Sampler
ComfyUI Node

MiniMax H3 Chain Audio Refine Sampler

Redo the sound, leave the seam alone

By ethanfel·Created 2 months ago·Updated a day ago· 467
MiniMax H3 Chain Audio Refine Sampler
  • model
  • positive
  • negative
  • latent
  • context_latent
  • LATENT
◄seed0►
◄steps6►
◄cfg1.0►
◄sampler_nameeuler►
◄schedulersimple►
◄audio_denoise0.50►

MiniMax H3 makes picture and sound in the same denoising loop - dialogue, room tone and foley come out of one latent, not a bolted-on audio pass. Great, until you want to fix the sound. Because audio and video share that latent, a naive audio re-pass reopens ticks you deliberately locked: carried prefixes, feathered exits, a source soundtrack you're lip-syncing against. At a scene boundary, that overwrites the last, perfectly good second of the previous scene.

This node is the chain-aware version of that pass: audio-only refinement, video frozen solid, original Chain Context audio mask honoured.

Where it sits in the graph

You reach for it after the first sampler has produced a finished joint AV latent and you're unhappy with only the sound - muddy dialogue, a washy tail, an effect that needs one more pass at lower denoise. It's a sampler, not a utility: it drops in between the sampling body and the decoders, replacing the third-party H3 Audio Refine Sampler, which opens every audio tick including a protected carried prefix. No extra pack needed.

What it actually does

It takes the finished latent plus context_latent - Apply Scene Context's latent output from before the first sampler. The tooltip's warning matters: that's the same scene's pre-sampling target, not a previous scene's checkpoint. And that latent is the authority on which audio ticks are protected, because a sampler may quietly drop its input noise_mask; the sampled latent alone can't be trusted for it.

From there it builds a video mask of all zeros (video can't move, full stop) and an audio mask - the context mask intersected, element-wise minimum, with the latent's own noise_mask if present. That minimum is the point: hard source locks stay at 0 while fractional masks survive, including the half-cosine feather a Soft AV continuation writes into the carried audio exit. Sampling then goes through ComfyUI's own comfy.sample.sample with a nested per-stream mask.

The guards are unusually honest for a wrapper. Afterwards it runs torch.where(audio_mask == 0, original_audio, refined), so locks keep their exact original bits even if the sampler's final conversion ran at another precision. An all-zero mask - fully source-locked audio, frozen video - skips sampling entirely. The output drops noise_mask and the drift-control AV prefix key so decoders and checkpoints don't inherit stale masks. And the model must be a clean branch: one that already carries a dynamic denoise-mask patch makes the node raise rather than let that patch reopen your frozen picture, so branch before Turbo LoRA and before Apply Scene Context's Drift patch.

Inputs worth setting

model, latent and context_latent are the wiring, and getting them wrong is the only real way to break this. The rest is a normal sampler:

  • audio_denoise - default 0.5, the one knob you actually tune: the fraction of the audio schedule that re-runs. 0.3–0.5 is a cleanup, 1.0 re-noises the whole open region. Locked ticks stay locked either way, so a high value can't undo your source audio.
  • steps / cfg / sampler_name / scheduler - defaults 6, 1.0, euler, simple: the distilled-H3 baseline.
  • seed - with the usual control_after_generate dropdown. Use the current scene's noise seed, or an explicit one to A/B the sound without moving the picture.

One output: LATENT. Wire it to both VAE decoders (video and audio), to Save Segment + Checkpoint's sampled_latent, and to Loop End's sampled_latent. Keep decoded frames flowing through Loop Trim like before.

Install

Install the pack plus its Motion Context companion, then restart ComfyUI:

cd ComfyUI/custom_nodes
git clone https://github.com/seitanism/ComfyUI-H3-Motion-Context-MultiRef.git
git clone --branch main https://github.com/ethanfel/ComfyUI-MiniMaxH3-Context-Loop.git

No requirements.txt, nothing to pip install - it's pure Python over ComfyUI's own sampler stack. You need a current ComfyUI build with native Add Guide for MiniMax H3 support, your own H3 diffusion model, text encoder and both VAEs (no models ship here), plus ffmpeg on PATH for the best review and assembly behaviour. In ComfyUI Manager, search the display name MiniMax H3 Context Loop - the Registry ID keeps a historical contex-loop misspelling, so don't search for that.

Things that go wrong

The error messages name the wire that's wrong, which is refreshing:

  • "H3 Chain Audio Refine needs a model branch before Apply Scene Context/Drift-Control and other dynamic denoise-mask patches." You handed it the patched model. Take a second branch off the loader, before the LoRA and the drift patch.
  • "requires video and stereo audio latents with batch size 1." The upstream sampler didn't emit a joint AV latent - feed it Sample Video + Audio's output.
  • "context_latent must be the same scene's pre-sampling target at the same resolution and length." You wired a previous scene's output, or a scene of a different size. Mixed-resolution chapters can't share AV context at all.
  • h3_masking: ... requires the native MiniMax H3 Add Guide / MultiRef core from ComfyUI PR #15439. Update ComfyUI and restart.

Two expectations to set. If the sound is already fully locked, the node does nothing and passes through - correct, not a bug. And the docs are explicit that this integration has CPU mask, saving and assembly coverage but no guarantee of perceptual improvement, with the originating issue (#97) still open and no fix claimed. Test before/after on one scene rather than trusting the wiring, and disable any Frozen Video Cache for that first comparison.

Categorysampling/minimax/context_loop

Inputs (11)

NameTypeDefaultDescription
modelMODELRefinement model branched BEFORE Turbo LoRA and Apply Scene Context's Drift patch. Optional Frozen Video Cache may fall back to uncached execution with protected audio.
positiveCONDITIONING—
negativeCONDITIONING—
latentLATENTFinished joint AV latent from Sample Video + Audio.
context_latentLATENTApply Scene Context's latent output, before the first sampler. Supplies the original carried/source-audio protection mask; not a previous scene's checkpoint.
seedINT00–18446744073709550000—
stepsINT61–100—
cfgFLOAT1.00–100—
sampler_nameCOMBOeuler44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38
schedulerCOMBOsimple9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3
audio_denoiseFLOAT0.500.01–1—

Outputs (1)

NameTypeDescription
LATENTLATENT—