jitter op : how to compare two matrices?

nicolight's icon

Hi,
I'm working on a dmx ligthing software and need to control the channels values for some "advanced crossfading".
I used jit.xfade to crossfade between to matrices : that was ok.
Now I'd like to compare each cell of the matrices so I can control the channels that light up and the ones that dim down separtly. (this is called time up and time down in lighting consoles)

I'd like to compare two 1D matrices to route their values in 3 ways like this :
Values that doesn't change, values that increase, values that decrease.
I tried to deal with jit.op but the result is not there !

any help would be welcome.
Nicolas

matrix-test.maxpat
Max Patch
Rob Ramirez's icon

the

p with the inputs reversed:

Max Patch
Copy patch and select New From Clipboard in Max.

nicolight's icon

Thanks so much.
I wonder why op

Why did you add zl.reg ? it seems to work without it.
... well it works anyhow!

How to deal with 0-254 ouput values that shall be 0-255 values?
In jit.op reference page, it is written that char matrix are mapped to the range 0-996...
Do I need to change char matrix to to float 32? seems to wrok but how do I convert float matrix to int matrix then?

Rob Ramirez's icon

< p works as expected. it passes the left input if less than the right input. you want to pass the right input if greater than the left input, there is not operator for that so you simply need to swap the inputs.

the zl.reg is there to ensure that the right operands are set prior to the left.

i'm not sure what your other question is referring to.

nicolight's icon

well I found another solution :
- using named matrix instead of using zl.reg.
- used jit.clip instead of < p
- I changed to float32 instead of char matrix.

As described in the jit.op reference, the calculation with char matrix gave a Strange result : the ouput values were 0-254, I was expecting 0-255

thanks

matrix-test2.maxpat
Max Patch