Getting Jitter matrix info into JS

skrasms's icon

I am trying to convert a way that I use jit.expr into javascript, but I am running into a problem getting javascript to call information about the incoming matrix, in this case its dimensions. I went through the tutorials but did not see anything about taking attributes from an input matrix.

The following patch shows the feature I want, the output matrix has the same dimensions as any input matrix.

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

To recreate this in javascript, I thought I could create a matrix and rescale it based on the incoming matrix something like this

var result_matrix = new JitterMatrix(1, "float32", 120, 1);
function jit_matrix(matrix_in)
{
    result_matrix.dim = matrix_in.dim;
    myexpr = new JitterObject("jit.expr");
    myexpr.expr = "in[0] + norm[0]";
    myexpr.matrixcalc(matrix_in, result_matrix)
    outlet(0, "jit_matrix", result_matrix.name);
}

...but matrix_in.dim is undefined. What can I do?