Forums > Jitter

Using [js] to Process an Incoming Matrix?

Sep 10 2010 | 2:41 pm

Hi – I’d like to use javascript to chop up and reorganize an image. The advantage of this over jit.scissors + jit.glue would be the ability to have varying chop sizes, as well as avoid absurd amounts of patch cables (a 16×16 chopping + reorganization of the matrix would mean 256 outlets from jit.scissors to 256 inlets of router; then 256 outlets of router to 256 inlets of jit.glue. Unfortunately, the Max Toolbox doesn’t cover single objects with multiple ins/outs connecting to each other).

I began looking at the js tutorials for jitter, and it seems all the movies get loaded within the js object. Is it possible to have a matrix go into the js object and then process it from there? or does the matrix data either have to be generated or read while inside the js object?


Sep 11 2010 | 10:02 pm

I know you could do it in [js] but not sure how, someone on here will know.

You could also use jit.submatrix maybe, or the srcdim/dstdim messages to take parts from the original and put it into a new one. So you’d have a long rapid-fire list of commands to that instead of all the patch cables, probably you could figure something out with [preset] to decide how things are chopped and rearranged (and how much control you want over that process).

Maybe two [matrixctrls] with one cell per matrix enabled: click the first (in a 16×16 grid) to select source, click the other for destination. [preset] or some math-generated functions (and [random] and [urn] could help too) could do the clicking for you…

Sep 13 2010 | 3:17 pm

my idea with the matrix was to simply have each square connected to a matrix cell, so if i have a 16×16 division of the matrix, i’d have 256 inputs/outputs for the matrix. was going to use random processes (triggered through amp analysis) to reorganize the squares.

i like the idea of using src/dst dim messages. it seems that text coding (ie js) using arrays/for loops would be better suited for this kind of thing, but i’ll figure something out using uzi (uzi = max for loop for me). thanks for the suggestion :)

Sep 13 2010 | 7:47 pm

Yes, if you want to do it in straight Jitter (no js), uzi and a little math will do the trick. Although the coding would be more explicit in js, I don’t know how it would stack up in terms of computation speed. Here’s an all-Max example. It’s got lots of hard coded numbers in it that are based on a 720×480 source image and a 16×16 grid, and it chooses the reordering randomly, but it shows the basic idea.

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

Forums > Jitter