Passing a Jitter matrix into the js object

Jul 21, 2013 at 4:56am

Passing a Jitter matrix into the js object

I am wondering how to pass in a 2D matrix from a max patch into a js object.

The reason why is that I have an FFT in the max patch with the magnitude and phase values stored in a matrix and I would like to pass the matrix into the js object to perform some calculations as it can process multiple calculations a lot faster, but I don’t want to make the whole patch inside the js object.

Any help or guidance would be appreciated, I am assuming it is possible to reference a matrix from outside the js object but I am not entirely sure.

#256624
Jul 21, 2013 at 10:36am

give the patch jitter matrix a name : jit.matrix mymat
reference it in js:
var jsmat = new JitterMatrix(“mymat”);

#256657
Jul 21, 2013 at 1:53pm

thanks! I had given the patch jitter matrix a scripting name (in the inspector – I haven’t worked out how to use it yet!) and was trying to use that, but changing it to the actual name of the matrix in the patch worked.

Also, do you have any idea what the best way is to swap two rows with each other in the matrix? I have been using jit.submatrix to store individual rows and then changing the destination location of the rows using the dstdimstart and dstdimend attributes before overwriting their position on the matrix, but it takes a long time and only can do one row replace at once it seems.

many thanks for your help.

#256666
Jul 21, 2013 at 1:57pm

ps. I have looked at objects such as jit.split and jit.scissors but due to the rows being 2048 long, these kinds of options aren’t really possible. If only jit.matrix had getrow and getcolumn attributes then I wouldn’t have a problem!

#256667

You must be logged in to reply to this topic.