A2SB Audio Inpainting
Audio Inpainting, Mask-Style
- a2sb_model
- audio
- audio
One bad second used to mean either re-recording the whole take or an afternoon of spectral surgery in a DAW. A2SB Audio Inpainting fixes it the way mask-based image inpainting fixes a photobomber: you mark the bad time range, the diffusion model regenerates exactly that segment, and the rest of the recording is left bit-identical. Same Schrödinger-bridge machinery as the pack's bandwidth-extension node, different mask - and it throws in an auto-declipper for free.
Why you'd reach for it
The image world went through this exact debate - whole-image edit models vs. masked inpainting - and the verdict there is the verdict here: a mask that only touches what's broken beats a model that redoes everything, because nothing else drifts. A cough in an otherwise clean voiceover, a dog bark during a podcast, a hard clip on the loudest syllable: mark it, regenerate it, move on. On top of that, this node can detect and repair clipped audio (the flat-topped, distorted peaks you get from overloading a mic) automatically.
How it works
Same core as the rest of the pack: waveform → STFT spectrogram, a mask, then the A2SB sampler walks the bridge from the corrupted state to a clean one while a data-consistency step pins everything outside the mask to your original. The difference is what makes the mask. Your segments string becomes time-based masks - each start-end pair (in seconds) blanks that stretch of the spectrogram. If auto_declip is on, the node also scans for clipped samples and merges a detection mask in with yours, so it heals blown-out peaks in the same pass.
There's a speed dial hiding in here: fast_mode (default on) finds the middle of each masked segment and runs the sampler only on those windows instead of the whole track. For a one-second gap in a ten-minute file that's the difference between "done" and "coffee break." Turn it off only if you see seams at segment edges.
The inputs that matter
- segments - the whole point. Format is
"1.0-1.5, 3.0-4.0": comma-separated start-end pairs in seconds, decimal points allowed. Listen to the file, note the bad times, type them. - auto_declip (default off) - turn on to auto-detect and repair clipped peaks. Pair it with declip_threshold (default
0.99), which is how aggressive the clip detector is; drop it toward0.9if obvious flat-topped peaks are being missed. - refiner_strength (default
1) - the pack's README suggests0.1–0.5to "smooth out" crunchy audio without changing content. At1you get full regeneration of the masked region; lower values just polish.
Also in the schema: steps (default 50), batch_size, fast_mode, unload_model (frees VRAM after a run), plus the audio and a2sb_model inputs that everything in this pack shares. The single output is audio (AUDIO) - wire it to a save node.
Installing it
Identical to the rest of the pack - it ships in the same repo, so one install covers all three nodes:
cd ComfyUI/custom_nodes
git clone https://github.com/mmoalem/comfyui-nvidia-audio-diffusion
cd comfyui-nvidia-audio-diffusion
pip install -r requirements.txt # or run install.py
Dependencies are einops, rotary-embedding-torch, librosa, soundfile, and torchao. The NVIDIA checkpoints (~6.8GB for the default two-split model) auto-download to ComfyUI/models/A2SB on the first run of the loader node. SageAttention is an optional extra for RTX 40/50 cards - nice for speed, not required.
Common issues
- Nothing gets touched. Check the
segmentsformat - each range must contain a-, ranges are comma-separated, and it's seconds, not milliseconds. If the node logsNo masked segments found, your string didn't parse. - Times feel off. Segment times are in real seconds regardless of the input sample rate, because the node resamples to 44.1kHz before computing the mask. Trust the clock in your player, not the track's rate.
- First run downloads a lot. The model pull is a few gigabytes and the console prints
[A2SB] Downloading ...per file. Give it time once, then it's local. - Declip not catching anything. Raise the threshold toward
1.0for subtler clipping, or lower it if loud flat-topped peaks are slipping through.
It's a surprisingly narrow tool that's shockingly good at its one job. If you do any voice work in ComfyUI - and especially if you've been hand-editing clicks and pops - this is the node that turns a ruined take into a usable one.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| a2sb_model | A2SB_MODEL | — | |
| audio | AUDIO | — | |
| steps | INT | 5010–200 | — |
| segments | STRING | 1.0-1.5, 3.0-4.0 | — |
| batch_size | INT | 161–64 | — |
| auto_declip | BOOLEAN | false | — |
| declip_threshold | FLOAT | 0.990.8–1 | — |
| refiner_strength | FLOAT | 1.000–1 | — |
| fast_mode | BOOLEAN | true | — |
| unload_model | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| audio | AUDIO | — |