Nodes/ComfyUI-sonar/SonarLatentOperationAdvanced
ComfyUI Node

SonarLatentOperationAdvanced

Schedule, scale, and blend any latent operation

By blepping·Created 3 years ago·Updated 15 days ago· 49
SonarLatentOperationAdvanced
  • operation
  • operation_alt
  • operation_2
  • operation_3
  • operation_4
  • operation_5
  • LATENT_OPERATION
start_sigma-1.000
end_sigma0.000
input_multiplier1.000
output_multiplier1.000
difference_multiplier1.000
blend_modeinject
blend_strength0.500

SonarLatentOperationAdvanced is the control wrapper for the pack's LATENT_OPERATION system. A latent operation by itself just runs and does its thing; this node lets you decide when it runs (scheduling by sigma), how hard it hits (multipliers), and how its effect combines with the latent (blend modes). It's the difference between "inject noise during sampling" and "inject noise only between sigma 8 and sigma 3, at 40% strength, blended rather than added." If you find yourself needing precision on top of an operation, this is where you build it.

How it works

You feed an operation in, and it gets wrapped with all the controls. The architecture matters: the effect is computed as the difference the operation makes from the input, and then that change is scaled and blended back in. That's what makes the multipliers and blend knobs behave so predictably.

The schedule is sigma-based, which is the right unit for "when during denoising":

  • start_sigma - first sigma the effect is active. Default -1 is the pack's "auto" - it uses whatever the model's maximum sigma is.
  • end_sigma - last sigma it's active. Default 0 (the end of sampling).

The multipliers, applied in order:

  • input_multiplier - scales what goes into the operation. Notably, the multiplied input is not used when calculating the difference, so this changes what the operation sees, not how the effect is measured.
  • output_multiplier - scales what comes out, before blending or difference calculation.
  • difference_multiplier - scales the difference (the actual change), after output_multiplier and before blending.

Then the blend:

  • blend_mode - lerp, inject (default), or subtract_b. inject adds the change scaled by blend strength - at 1.0 it's just the operation's raw output, no modification.
  • blend_strength - default 0.5, how much of the change gets through.

The scheduling trick

The optional operation_alt input is genuinely clever. It's an alternative operation used when the primary isn't enabled. The tooltip's example: you want one operation between sigma 1.0 and 0.5, then a different operation below 0.5 - which is annoying to specify by hand (you'd have to set the second one to start at 0.499999). With operation_alt, you give the second operation and the handoff happens cleanly at the boundary. There are also operation_2 through operation_5 inputs that run in sequence before blending and output scaling, so this one node can orchestrate a whole chain of operations.

Where you'd use it

Any place you're combining this pack's operations with intention: schedule SonarLatentOperationNoise to only inject during the detail-forming mid-steps, blend a SonarLatentOperationQuantileFilter in softly instead of hard, or run several operations in sequence and scale the total effect. It's also the natural front door to the pack's FreeU-Extreme-style workflows, which are built on filtered, scheduled, blended operations.

Install

ComfyUI Manager → search "ComfyUI-sonar" → Install → restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/blepping/ComfyUI-sonar

No models, no extra deps. The author's ComfyUI-bleh pack upgrades the blend menu from three modes to "any blend mode it provides" - worth installing if you find yourself wanting fancier blends than lerp/inject/subtract_b.

Categorylatent/advanced/operations

Inputs (13)

NameTypeDefaultDescription
operationLATENT_OPERATIONLatent operation to apply.
start_sigmaFLOAT-1.000-1–10000First sigma the effect becomes active. You can set a negative value here to use whatever the model's maximum sigma is.
end_sigmaFLOAT0.0000–10000Last sigma the effect is active.
input_multiplierFLOAT1.000-10000–10000Flat multiplier on the input to the latent operation. The multiplied input is *not* used when calculating the difference, it is only passed to the operation.
output_multiplierFLOAT1.000-10000–10000Flat multiplier on the output from the latent operation. Occurs before blending or calculating the difference.
difference_multiplierFLOAT1.000-10000–10000Flat multiplier on the difference or change from the original that the operation performed. Occurs after output_multiplier and before blending applies.
blend_modeCOMBOinjectControls how the change from the operation is combined with the input. The default of inject just adds it scaled by the blend strength. With 1.0 blend strength, this is just using the output from the operation with no change.
blend_strengthFLOAT0.500-10000–10000Strength of the blend.
operation_altoptLATENT_OPERATIONOptional alternative operation that will be used when the primary one isn't enabled. May be useful in a case when you want one operation between sigma 1.0 and 0.5 and then a difference operation for lower sigmas which is kind of annoying to specify manually (you'd need to do something like configure another operation to start at 0.499999 or something).
operation_2optLATENT_OPERATIONOptional LATENT_OPERATION. The operations will be applied in sequence.
operation_3optLATENT_OPERATIONOptional LATENT_OPERATION. The operations will be applied in sequence.
operation_4optLATENT_OPERATIONOptional LATENT_OPERATION. The operations will be applied in sequence.
operation_5optLATENT_OPERATIONOptional LATENT_OPERATION. The operations will be applied in sequence.

Outputs (1)

NameTypeDescription
LATENT_OPERATIONLATENT_OPERATION