Forums > MaxMSP

MatrixCtrl data to Javascript

September 23, 2011 | 12:05 pm

Hi there,

I’m working on a CA patch for a uni project and I’m trying to figure out how to get the list data from Matrixctrl into Javascript in order to transform each active point into a bang. I’m trying to get to grips with Javascript asap at the moment. I think I need to create Arrays and then a list of if statements perhaps? What I’m not entirely sure how to do is get the data into the js object to input into matrices. Am I on the right track?



September 24, 2011 | 12:39 pm

Actually I’ve found a lot of useful information in the javascript examples section. Working on it!


September 25, 2011 | 4:47 pm

Well look, here it is – does anybody actually know if it’s at all possible to simultaneously bang the output from a matrixctrl, then store and sort the cell values in javascript in order to send individual bangs/events out of the javascript object?

It’s a question, the answer to which I just cannot find, nor do I have the programming capacity to come up with the code if it is possible. I can only get individual cells to do anything, such as a simple print to the Max window function when I click on a cell.



September 25, 2011 | 5:56 pm

What do you mean by "transform each active point in to a bang"? I’m not really sure what you’re asking for. Could you post a patch that might help me see what you intend. Or even a few examples of what you’d send the javascript object and what you want it to output.

September 25, 2011 | 7:11 pm

Hi Luke,

Thanks for your reply. I’ve got a CA patch that works (I got it from here somewhere) and I can output the matrixctrl data into a matrix~ object but this seems like a waste to me. I’m trying to figure out how to let each live cell trigger its own event, be it a bang or a frequency or whatever. I’m looking for ways to map really,other than operating a multi gate like the matrix~ object. I thought if I used javascript I could do things like if 0,0 has value 1 then do this, if 0,1 has value 1 etc.. So for each iteration each cell is checked for on/off. Have been checking out bits of code from the forum (probably some of yours too) and all do different things but not that.

I’ll upload stuff later, gotta run

September 29, 2011 | 5:50 pm

Here’s a sample patch. I’ve not included a js file because it just wasn’t happening.


  1. c.a.Example.maxpat
September 29, 2011 | 6:20 pm

Here’s another with a visual example of the intended javascript function.

September 29, 2011 | 10:23 pm

Something like this which numbers the cells left to right and top to bottom?

— Pasted Max Patch, click to expand. —
September 30, 2011 | 9:50 am

Hmm..yes..exactly that. And the same procedure could be applied to the jit.iter object using zl join. Very clever!

As a matter of interest, do you think there’s a js solution?

Many thanks, I’ve been stuck on that problem for a little while now.


September 30, 2011 | 11:05 pm

Disclaimer: not tested, but should at least give you some clues.

`outlets = 16;

function list (x, y, state) {
if (state) {

You could even set the dimensions that the js will work with using arguments.

October 1, 2011 | 2:27 pm


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

Forums > MaxMSP