Nodes/ComfyUI-sonar/SonarAdvancedCollatzNoise
ComfyUI Node

SonarAdvancedCollatzNoise

Custom noise type that allows specifying parameters for Collatz noise. Very experimental, also very slow. It might just about work as initial noise with non-ancestral sampling but if you get weird results I recommend mixing it with other noise types or possibly using ancestral/SDE sampling.

By blepping·Created 3 years ago·Updated 4 days ago· 49
SonarAdvancedCollatzNoise
  • sonar_custom_noise_opt
  • seed_custom_noise
  • mix_custom_noise
  • SONAR_CUSTOM_NOISE
factor1.000
rescale0.000
adjust_scalefalse
chain_length1, 1, 2, 2, 3, 3
chain_offset5
iterations10
iteration_sign_flippingtrue
rmin-8000.000
rmax8000.000
dims-1, -1, -2, -2
flattenfalse
output_modevalues
quantile0.500
quantile_strategyclamp
noise_dtypefloat32
even_multiplier0.500
even_addition0.000
odd_multiplier3.000
odd_addition1.000
integer_mathtrue
add_preserves_signtrue
break_loopstrue
seed_modedefault
Categoryadvanced/noise

Inputs (26)

NameTypeDefaultDescription
factorFLOAT1.000-10000–10000Scaling factor for the generated noise of this type.
rescaleFLOAT0.0000–10000When non-zero, this custom noise item and other custom noise items items connected to it will have their factor scaled to add up to the specified rescale value. When set to 0, rescaling is disabled.
adjust_scaleBOOLEANfalseWhen enabled, the output will be normalized to values between -1 and 1 using the last two dimensions (if there are four or more), otherwise dimensions after the first.
chain_lengthSTRING1, 1, 2, 2, 3, 3Comma-separated list of chain lengths. Cannot be empty. Iterations will cycle through the list and wrap. Controls the length of Collatz chains. Note: Using a high chain length may be very slow, especially if combined with many iterations.
chain_offsetINT50–10000Uses values starting at the specified offset. Note: This entails generating chains of length chain_length + chain_offset, which may be quite slow if you use high values.
iterationsINT101–10000Number of iterations to run. Warning: Collatz noise (my implementation, anyway) is EXTREMELY slow.
iteration_sign_flippingBOOLEANtrueControls whether we cycle between flipping the sign on the output from each iteration. May average out weirdness... Or make stuff weirder.
rminFLOAT-8000.000-10000–10000Minimum value a chain can start with. Going as low as -9500 should be safe with float32.
rmaxFLOAT8000.000-10000–10000Maximum value a chain can start with. I don't recommend going over 9500 if you are using the float32 dtype here as that is where the Collatz chain starts to reach values that can't be accurately represented.
dimsSTRING-1, -1, -2, -2Comma-separated list of dimensions. Cannot be empty. May be negative to count from the end of the list. Iterations will cycle through the list and wrap.
flattenBOOLEANfalseControls whether dimensions past the current one selected from the dims parameter will get flattened.
output_modeCOMBOvalues9 options: values, ratios, mults, adds, seed_x_mults, seed_x_adds, +3
quantileFLOAT0.5000–1The initial output of each iteration will be run through quantile normalization. Setting the parameter to 0 or 1 will disable quantile normalization.
quantile_strategyCOMBOclampDetermines how to treat outliers. zero and reverse_zero modes are only useful if you're going to do something like add the result to some other noise. zero will return zero for anything outside the quantile range, reverse_zero only _keeps_ the outliers and zeros everything else.
noise_dtypeCOMBOfloat32Generally should be left at the default. Only float32 and float64 will work if you have quantile normalization enabled.
even_multiplierFLOAT0.500-10000–10000Multiplier to use when the previous link in the chain is even. Collatz uses 0.5 (divides by two) here.
even_additionFLOAT0.000-10000–10000Value to add when the previous link in the chain is even. Collatz uses 0 here.
odd_multiplierFLOAT3.000-10000–10000Multiplier to use when the previous link in the chain is odd. Collatz uses 3 here.
odd_additionFLOAT1.000-10000–10000Value to add when the previous link in the chain is odd. Collatz uses 1 here.
integer_mathBOOLEANtrueControls whether the results during chain generation get truncated to an integer value or not. Should be enabled if you actually want to generate accurate Collatz chains.
add_preserves_signBOOLEANtrueControls whether additions use the same sign as the item they're being added to.
break_loopsBOOLEANtrueControls whether the chain resets back to the seed value once it reaches 1 or 0. Generally should be left enabled, otherwise the chain will oscillate between only a few values for the rest of the length (at least with the Collatz rules).
seed_modeCOMBOdefaultDefault mode just uses whatever the original seed value was. force_odd/force_even will force it to the specified parity by adding one if it doesn't match. Starting from odd seeds might result in longer chains. Enabling the force modes may cause the initial seeds to exceed rmax by one.
sonar_custom_noise_optoptSONAR_CUSTOM_NOISE,OCS_NOISEOptional input for more custom noise items. The following input types are supported: SONAR_CUSTOM_NOISE, OCS_NOISE
seed_custom_noiseoptSONAR_CUSTOM_NOISE,OCS_NOISEOptional custom noise to use for initial values for Collatz chains. May be slow as it will generate noise according to the original input size and then crop it. Does this noise type have enough warnings about it being slow? Yeah. Connecting something here will probably make it even slower! The following input types are supported: SONAR_CUSTOM_NOISE, OCS_NOISE
mix_custom_noiseoptSONAR_CUSTOM_NOISE,OCS_NOISEOptional custom noise to use with the output modes starting with 'noise'. The following input types are supported: SONAR_CUSTOM_NOISE, OCS_NOISE

Outputs (1)

NameTypeDescription
SONAR_CUSTOM_NOISESONAR_CUSTOM_NOISEA custom noise chain.