Stable Audio 3 Inpaint Conditioning
Cut one bad bar out of a track with Stable Audio 3 — inpainting and outpaint in ComfyUI
- positive
- negative
- vae
- audio
- regions
- positive
- negative
- latent
- duration
When Stable Audio 3 landed in ComfyUI with day-0 support in May 2026, it could generate audio from a prompt - and that was it. Regenerate one wrong section of an existing track? Extend a clip past where it ends? The community asked out loud and got radio silence for weeks. This node is the answer to that question: it's the orchestrator that makes SA3 inpainting and continuation actually work, sitting between your region selections and the KSampler. It encodes your source audio, figures out which slices of the latent timeline are "fair game," and hands the sampler everything it needs to rewrite only those slices - keeping the rest of your track intact.
How it works
This is the deep one, so bear with me for a paragraph. The node encodes your full source clip into the Stable Audio 3 VAE latent space (44.1 kHz, 4096x temporal compression - so each latent step is roughly 0.09 seconds of audio). Every region you connect gets converted to a span of latent steps, and those spans are marked with a mask of ones. From there it does two things at once:
- It injects the masked audio and that mask into the model conditioning (
concat_latent_image/concat_mask, plus the totalseconds_total) - the model-native inpaint path that tells SA3 where to fill. - It attaches the mask to the output latent as a
noise_mask, which is the flag ComfyUI's sampler uses to freeze everything outside the selected regions.
Total duration is chosen automatically: the greater of your source's length and the latest region end time, capped at 384 seconds. Region ends beyond the source just extend the timeline - that's the outpaint trick, and it means this one node does both audio surgery and audio extension without you building anything extra.
The input that changes everything: preserve_outside_mask
Default is true, and the author's own tooltip says it plainly: it keeps source latents fixed outside the selected regions. Leave it on - it's the "safe surgery" mode where everything outside the region is bit-identical to your original.
Turn it off and you get model-native inpainting, where the model decides how the neighborhood responds - and the author's caveat is that it may alter surrounding audio. That can sound more cohesive for a hard rewrite, but you lose the guarantee that the rest of the track survives untouched. My advice: keep it on while dialing in a region, flip it off only if the seams bother you.
Everything else
positive/negative come from CLIPTextEncode (positive describes the replacement sound - "replace this section with a bright synth melody matching the surrounding music" is literally the example prompt), vae off the SA3 checkpoint, audio from LoadAudio, and regions is an autogrow socket accepting one or more StableAudio3InpaintRegion nodes (up to 16 - drag out more sockets as needed). Wire the three main outputs - positive, negative, latent - into the KSampler, and duration is a bonus float telling you the total output length in seconds.
Sampling from the README: 8 steps, CFG 1, lcm sampler, simple scheduler, denoise 1.0. Full regeneration only inside the mask is the point, so don't dial denoise down here like you would for audio-to-audio.
Installing
ComfyUI Manager → search "stable audio 3 edit", or:
cd ComfyUI/custom_nodes
git clone https://github.com/pavel-zinchenko/comfyui-stable-audio-3-edit
Restart after. No Python dependencies at all - this is a native-API pack, so you need ComfyUI 0.33.0+ or the nodes won't register. Models are manual: stable_audio_3_medium.safetensors → models/checkpoints/, t5gemma_b_b_ul2.safetensors → models/text_encoders/, both from Comfy-Org/stable-audio-3 on Hugging Face.
Where people get burned
Every failure mode here is a validation error with a readable message, which is more than most packs give you. No regions connected → error, at least one is required. end <= start → error. A region shorter than a single latent step (under ~0.09 s) → error. Anything pushing past 384 seconds → error. And the VAE check is strict - it refuses anything that isn't the SA3 VAE (256 latent channels, 4096x compression), so the old Stable Audio 1 model won't work. The classic trap isn't an error at all though: forgetting that a region's end time extends the output - if you mean to touch up seconds 30–35 of a 40-second track, a stray region ending at 90 quietly turns the job into an outpaint.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| positive | CONDITIONING | — | |
| negative | CONDITIONING | — | |
| vae | VAE | — | |
| audio | AUDIO | — | |
| regions | COMFY_AUTOGROW_V3 | Connect one or more Stable Audio 3 Inpaint Region nodes. | |
| preserve_outside_mask | BOOLEAN | true | Keep source latents fixed outside the selected regions. Disable for model-native inpainting that may alter surrounding audio. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| positive | CONDITIONING | — |
| negative | CONDITIONING | — |
| latent | LATENT | — |
| duration | FLOAT | — |