MatrixCtrl data to Javascript

Sep 23, 2011 at 12:05pm

MatrixCtrl data to Javascript

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?

Thanks,

G.D.

#59006
Sep 24, 2011 at 12:39pm

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

G.D.

#211996
Sep 25, 2011 at 4:47pm

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.

Thanks.

G.

#211997
Sep 25, 2011 at 5:56pm

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.

#211998
Sep 25, 2011 at 7:11pm

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

#211999
Sep 29, 2011 at 5:50pm

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

Graham

Attachments:
  1. c.a.Example.maxpat
#212000
Sep 29, 2011 at 6:20pm

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

#212001
Sep 29, 2011 at 10:23pm

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

– Pasted Max Patch, click to expand. –
#212002
Sep 30, 2011 at 9:50am

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.

G.

#212003
Sep 30, 2011 at 11:05pm

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

`outlets = 16;

function list (x, y, state) {
if (state) {
outlet(y*4+x,”bang”);
}
}

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

#212004
Oct 1, 2011 at 2:27pm

Brilliant!

#212005

You must be logged in to reply to this topic.