Forums > Jitter

Passing a Jitter matrix into the js object

July 21, 2013 | 4:56 am

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.


July 21, 2013 | 10:36 am

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


July 21, 2013 | 1:53 pm

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.


July 21, 2013 | 1:57 pm

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!


Viewing 4 posts - 1 through 4 (of 4 total)