Nodes/ComfyUI-sonar/SonarLatentOperationNoise
ComfyUI Node

SonarLatentOperationNoise

Inject custom noise mid-sampling, where plain KSampler can't reach

By blepping·Created 3 years ago·Updated 15 days ago· 49
SonarLatentOperationNoise
  • custom_noise
  • LATENT_OPERATION
scale_to_sigmafalse
cpu_noisefalse
normalizetrue
lazy_noise_samplertrue

SonarLatentOperationNoise is a latent operation that injects noise into the latent during sampling, using whatever custom noise chain you give it. If you've ever wanted "add a burst of colored noise at the mid-point of denoising" or "inject a bit of extra structure into the initial latent," this is the node. It's the pack's noise machinery rebuilt as a LATENT_OPERATION - a pluggable thing that slots into the pack's operation-based nodes (like SonarLatentOperationAdvanced, SonarLatentOperationFilteredNoise, or the CFG-apply nodes) rather than running standalone.

How it works

  • custom_noise - the noise chain to inject. Anything the pack can generate.
  • scale_to_sigma - scales the noise to the current sigma when enabled. This is the setting that makes the injection behave like the sampler's own noise: stronger early, weaker late. Leave it off and you get a flat-strength injection regardless of where you are in the schedule.
  • normalize - default true, normalizes the injected noise.
  • cpu_noise - default false, so noise generates on GPU by default (faster), with the pack's usual caveat that this can change seeds across GPU models.
  • lazy_noise_sampler - default true. This caches the noise sampler between calls and only rebuilds it when necessary, which is a big speed win during multi-step sampling. The tooltip is admirably honest: there's no 100% reliable way for a latent operation to know when sampling starts and ends, so if the heuristic gets it wrong you get non-deterministic generations. If you notice results varying between identical runs, disable this before anything else.

Output is LATENT_OPERATION, which feeds a consumer node - commonly SonarLatentOperationAdvanced (to schedule when it runs) or one of the pack's apply-operation CFG nodes.

Why you'd use it

Stock ComfyUI gives you one noise injection point: the very start of sampling. A latent operation gives you the ability to add noise at chosen points in the schedule - the classic trick being a mid-sampling noise bump to rescue a generation that's collapsing, or adding detail-enhancing structure at low sigma. The README's FreeU-Extreme and Wavelet-CFG sections are built on this same operation machinery, so if you've seen those in the wild, you've seen this concept working.

Gotchas

The lazy_noise_sampler non-determinism warning is the one to remember - it's the author explicitly telling you "if results get weird, turn me off." And since injected noise scales with sigma when scale_to_sigma is on, a tiny factor difference in your noise chain can have outsized effects mid-schedule. Change one thing at a time.

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. For pairing with this node, the author's ComfyUI-bleh pack adds more blend modes to SonarLatentOperationAdvanced, but nothing here requires it.

Categorylatent/advanced/operations

Inputs (5)

NameTypeDefaultDescription
custom_noiseSONAR_CUSTOM_NOISE,OCS_NOISEAllows connecting a custom noise chain. The following input types are supported: SONAR_CUSTOM_NOISE, OCS_NOISE
scale_to_sigmaBOOLEANfalseScales the noise to the current sigma.
cpu_noiseBOOLEANfalseControls whether noise is generated on the CPU or GPU. GPU is usually faster but may change seeds for different models of GPU.
normalizeBOOLEANtrueControls whether the generated noise is normalized.
lazy_noise_samplerBOOLEANtrueWhen enabled, the latent operation will attempt to cache the noise sampler between calls and only recreate it when necessary. However, there isn't a 100% reliable way for a latent operation to know when sampling starts/ends so if we get it wrong this will lead to non-deterministic generations. I believe the heuristic I'm using to detect this should be reliable but you can disable it if you notice weird results.

Outputs (1)

NameTypeDescription
LATENT_OPERATIONLATENT_OPERATION