## why do I need to reverse the [t I I] in this patch?

Aug 18, 2011 at 1:10pm

# why do I need to reverse the [t I I] in this patch?

Hi!

Im using patch for framedifferencing and trying to understand whats going on in the patch.

I dont understand why i need to cross attache the [t I I] object to display the difference. If Im not Im not just getting a picture when something is changing:

so:
1) why do I need the [t l l] object

2) why do I need to cross connect the [t l l]

– Pasted Max Patch, click to expand. –
#58521
Aug 18, 2011 at 1:38pm

By crossing the patch cords this happens:
1) You pass the current matrix, and then store it by passing it by the absdiff right inlet (this is how the function absdiff works: compares current matrix with a value or an stored matrix).
2)Then you pass a new current matrix, and as you have stored a matrix in the previous frame, then absdiff will have something to compare with (the previously stored frame).

The first time no comparison is made, as there is no matrix stored yet.

#210291
Aug 18, 2011 at 1:41pm

think about what you need and then the order of operations:
you need: previous frame to be subtracted from the current frame. So somehow you have “store” it befor the next frame comes along.
now, order of operations: if you have a [t l l] the right “l” is sent out first, then the left. So if the right one goes into the left inlet of [jit.op] it triggers the computation, then it puts the current frame into “storage” for the next computation in the right inlet (ie. no output). next (new) frame comes along, first goes into the left inlet and triggers the computation with the previously “stored” frame, then puts the current frame into “storage”,…

make sense??

#210292
Aug 18, 2011 at 1:44pm

thanks

but why do I need to reverse them? Im thinking that:

- max sends messages from right to left
- [jit.op @op absdiff] needs to get the signal to compare into the right inlet before the left
- then the right outlet should be connected to the right inlet of [jit.op @op absdiff] and not the left outlet.

why?

#210293
Aug 18, 2011 at 1:47pm

I think that if you don’t reverse the patch cords, then you would always be comparing the matrix with itself all the time (you send the matrix to the right inlet, then to the left index, then comparison is made….they are the same matrices!)

You are right that jit.op@absdiff needs the right inlet input first in order to “compare” something, that is why (and this is my own guess)the first time you use jit.op absdiff, it considers that it has a null-matrix stored (a matrix in which all cells are 0). So the comparison is made with 0.

#210294
Aug 18, 2011 at 2:49pm
– Pasted Max Patch, click to expand. –
#210295
Aug 21, 2011 at 12:26pm

ok thanks!

one more question though.

what exactly does this mean [jit.op @op > @val 0.1]

#210296
Nov 1, 2011 at 9:14am

Hi,
I’m trying to use this operator in a complex JS code full of matrix.
Has someone any idea on how to do that framedifferencing in JS.
Here’s one attempt without success.
The question is how to manage the “inlets”.
Is this at least possible in JS?
Thanks

autowatch = 1;
outlets = 2;

var mtrxone = new JitterMatrix(1, “float32″, 2, 2);
var mtrxtwo = new JitterMatrix(1, “float32″, 2, 2);
var mtrxthree = new JitterMatrix(1, “float32″, 2, 2);

function jit_matrix(name)
{
mtrxone.name = name;
mtrxone.name = name;
outlet(1, “jit_matrix”, mtrxone.name);
}

function bang()
{

jit_matrix();
mtrxthree.op(“absdiff”, mtrxtwo, mtrxone);
outlet(0, “jit_matrix”, mtrxthree.name);
}

#210297

You must be logged in to reply to this topic.