Audio Branch Select (lazy)
One switch instead of three restoration chains
- original_audio
- restored_audio
- bandwidth_audio
- audio
- branch_report_json
- info
The problem it actually solves
Sooner or later every music pipeline grows two or three possible "fixes" for the audio: a gentle restore, an aggressive bandwidth reconstruction, and doing nothing. In this toolkit those branches exist as a restoration chain and a FlashSR-style bandwidth chain, and a graph that hard-wires one of them has a nasty property - a replacement branch carries its own sample rate, channel count and length. Run a perfectly healthy song through the reconstruct-bandwidth path and you can come out with a silently resampled or padded file. The pack's own notes are blunt about the old behaviour: the previous Original SRC only mode took rate and length from the replacement branch.
This node turns that into a named decision. Keep original, blend in a careful restore, or blend in reconstructed bandwidth - and the output always conforms to the original input's contract, never the other way round.
How it works
The profile dropdown maps to a fixed set of branches, and the node declares which upstream inputs each profile actually needs. It implements ComfyUI's check_lazy_status, so when you pick Keep original, the restored and bandwidth inputs are simply never requested - the branch nodes behind them don't execute. That's real lazy evaluation, not a mute: only the branches your profile doesn't need are skipped.
Whatever the chosen branch hands back is conformed to the original before it's used. If the replacement runs at a different sample rate it gets resampled with a polyphase Kaiser filter; batch, channel count, and length are matched by repeat, mean, pad or trim. Every one of those adjustments is logged in the report, so you can see whether the clean-sounding A/B you just did was actually a fair comparison. Then the two signals are blended with mix. Set mix to 0 and you get the original plus a note telling you the replacement ran with zero weight.
Worth saying plainly, because it's the usual misunderstanding: lazy evaluation stops the other branches from running. The branch you selected still runs upstream, in full. It isn't free.
Inputs and outputs
Four things matter. profile is the whole node - Keep original, Careful restore, Reconstruct bandwidth. mix (0–1, default 0.35) is how much of the replacement you're hearing; 0.35 is a tasteful starting point, 1.0 is a full swap. preview_seconds trims the result for a quick listen and is clamped into a 15–30 second window if you set it above zero. original_audio is required; restored_audio and bandwidth_audio are optional and only demanded when the chosen profile needs them.
The outputs are audio (wire it on to mastering or your saver - it's a normal AUDIO dict), branch_report_json with the profile, mix, conform notes and in/out format, and info, a one-line summary you can preview in the graph. The report is the useful one when a mix sounds off: it tells you if the branch you blended in had to be resampled or padded to fit.
Installing it
It comes with the toolkit, so you don't install it on its own. In ComfyUI Manager search MiniMax Music Production Toolkit, or:
cd ComfyUI/custom_nodes
git clone https://github.com/jplenio/ComfyUI-MiniMax-Music-Production-Toolkit.git
cd ComfyUI-MiniMax-Music-Production-Toolkit
python -m pip install -r requirements.txt # use the Python that runs ComfyUI
Restart ComfyUI and hard-refresh the browser afterwards. The DSP here leans on SciPy and SoundFile; the pack pulls numpy, scipy, soundfile, imageio-ffmpeg, mutagen and Pillow, and deliberately does not replace your PyTorch. The nodes appearing without a restart, or five nodes and a missing sixth, is almost always an import failure - check the console for IMPORT FAILED.
Where people get burned
The one error you'll actually see is self-explanatory: choosing Careful restore without anything plugged into restored_audio raises and tells you to connect it or switch profiles. That's the node refusing to guess, which is the point of it.
Beyond that, two habits. Don't audition a blend without reading branch_report_json - a replacement that had to be resampled at a different rate can flatter itself. And don't rely on preview_seconds to make an expensive branch cheap: it trims after the fact, so it saves your save/encode stages, not the inference. If the branch itself is slow, turn the profile off.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| profile | COMBO | Careful restore | Configuration input 'profile'. This value is passed directly to the node's processing logic; keep it at the workflow default unless you intentionally want to change that part of the production chain. |
| mix | FLOAT | 0.350–1 | Configuration input 'mix'. This value is passed directly to the node's processing logic; keep it at the workflow default unless you intentionally want to change that part of the production chain. |
| preview_seconds | FLOAT | 00–60 | Configuration input 'preview seconds'. This value is passed directly to the node's processing logic; keep it at the workflow default unless you intentionally want to change that part of the production chain. |
| original_audio | AUDIO | Configuration input 'original audio'. This value is passed directly to the node's processing logic; keep it at the workflow default unless you intentionally want to change that part of the production chain. | |
| restored_audioopt | AUDIO | Configuration input 'restored audio'. This value is passed directly to the node's processing logic; keep it at the workflow default unless you intentionally want to change that part of the production chain. | |
| bandwidth_audioopt | AUDIO | Configuration input 'bandwidth audio'. This value is passed directly to the node's processing logic; keep it at the workflow default unless you intentionally want to change that part of the production chain. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| audio | AUDIO | — |
| branch_report_json | STRING | — |
| info | STRING | — |