ComfyUI Extension: More Math
Adds math nodes for FLOAT, CONDITIONING, LATENT, IMAGE, NOISE and AUDIO. Allows usage of math expressions with variety of functions and variables, not limited to inputs. List of those is on github of this extension.
Custom Nodes (0)
README
More Math
Adds math nodes for numbers and types which do not need it. I got inspired by was_extras node.
#WARNING This node is not compatible to ComfyUI-Impact-Pack which forces older antlr version.
Quickstart
- Install ComfyUI.
- Clone this repository into
ComfyUI/custom_nodes
. - Restart ComfyUI.
You can also get the node from comfy manager under the name of More math.
Features
- functions and variables in math expressions
- Nodes for CONDITIONING, LATENT, IMAGE, NOISE, FLOAT, and AUDIO
Operators
- Math:
+
,-
,*
,/
,%
,^
- Boolean:
<
,<=
,>
,>=
,==
,!=
(false = 0.0
,true = 1.0
)
Functions
- Basic:
abs
,sqrt
,ln
,log
,exp
,pow
- Trigonometric:
sin
,cos
,tan
,asin
,acos
,atan
,atan2
- Hyperbolic:
sinh
,cosh
,tanh
,asinh
,acosh
,atanh
- Aggregates:
smin
,smax
,snorm
(scalar),tmin
,tmax
,tnorm
(elementwise) - Other:
floor
,ceil
,round
,gamma
,clamp
,sigm
(sigmoid) - Audio-specific:
fft
(short-time FFT),ifft
(inverse sFFT always return audio back to time domain before leaving node),angle
(in ifft only)
Variables
-
common inputs (matches node input type):
a
,b
,c
,d
-
Extra floats:
w
,x
,y
,z
-
IMAGE and LATENT:
C
orchannel
- channel of imageX
- position X in image. 0 is in top leftY
- position Y in image. 0 is in top leftW
orwidth
- width of image. y/width = 1H
orheight
- height of image. x/height = 1B
or 'batch' - position in batch- 'T' or 'batch_count` - number of batches
N
orchannel_count
- count of channels
-
AUDIO:
B
or 'batch' - position in batchN
orchannel_count
- count of channelsS
orsample
– current audio sample- 'T' or 'sample_count` - audio lenght in samples
R
orsample_rate
– sample rateF
– frequency count (freq domain, iFFT only)K
– current frequency (freq domain, iFFT only)
-
VIDEO
- refer to
IMAGE and LATENT
for visual part (butbatch
isframe
andbatch_count
isframe_count
) - refer to
AUDIO
for sound part
- refer to
-
NOISE
- refer to
IMAGE and LATENT
for most variables I
orinput_latent
– latent used as input to generate noise before noise is generated into it
- refer to
-
CONDITIONING and FLOAT
- no additional variables
-
Constants:
e
,pi