External of simple js?

Jun 12, 2010 at 7:15am

External of simple js?

This would be very usefull for using in conjunction with a matrixctrl, when feeding the input of a grid controller (especially in m4l). I’m using the js now to cut down data flow, but I’m thinking it would work better if it were built as a C (or Java) external and could operate at high priority. Perhaps its unimportant (because matrixctrl is always defered? I can’t tell and I’ve been looking around)…if so, someone please set me straight.

It merely filters data from the cells of a matrixctrl from being sent when the matrixctrl receives a bang and the data hasn’t changed since the last bang. Its basically a [change] object, but for a matrixctrl.

autowatch=1

var matrix=[];

init();

function init()
{
    for(d=0;d<16;d++)
    {
        matrix[d]=[];
        for(dd=0;dd<16;dd++)
        {
            matrix[d][dd]=0;
        }
    }
}

function list(x, y, v)
{
    if(matrix[x][y]!=v)
    {
        outlet(0, x, y, v);
        matrix[x][y]=v;
    }
}

Any help greatly appreciated. It would be easy (I suppose) to have two arguments specifying the dimensions of the matrixctrl.

#50865
Jun 12, 2010 at 1:23pm

I remember posting something similar in an older thread. Have a look at the other solutions there.

lh

#182511
Jun 12, 2010 at 10:14pm

Thanks for the response, Luke.

Unfortunately, those don’t work for me either.

I’m using this for several patches in m4l. The js bogs the system, and besides won’t operate at high priority (the immediate property in m4l js doesn’t play well with ableton, apparently, so all js is stuck in deferred queue). I need some kind of external.

I thought the pattr trick might work, but it still sends EVERY cell each time one of the cells change. I’m looking for something cheap that will do the job, and I’m thinking C or Java is the way. Unfortunately, I don’t know either, so hopefully someone can help me out.

Your js is actually exactly what I’m looking for, only in a form that is overdrive friendly.

Thanks again :)

#182512
Jun 13, 2010 at 5:24am

Hello maxer,

Have you tried

list.immediate = 1

???

#182513
Jun 13, 2010 at 8:50am

(the immediate property in m4l js doesn’t play well with ableton, apparently, so all js is stuck in deferred queue)

In a straight Max patch this would be fine, but in m4l the immediate property causes instability. I haven’t gotten a technical answer as to why yet, but the bottom line is that it doesn’t work. I know for a fact (through experimentation) that if you try to run two identical js objects in different m4l patches with any functions immediate property set to (1), it will crash Live. I’ve also used unique js objects with funciton.immediate=1, and although it does run the function in high priority for a while without crashing, it totally foobars audio in m4l when doing anything that I might want to do.

Thats why I’m looking for a solution that is external.

Thanks for posting, I’m hoping a simple solution that I’ve overlooked (like the one you posted) will be a the answer.

#182514
Jun 13, 2010 at 3:49pm

Hello amounra,

oops : i don’t have M4L ;-)

have you tried to make an abstraction with native max objects ; should not so hard to do with [coll] or [funbuff] ? When it’s possible i avoid doing C external ; as doing an external is sometimes more problems created than problems solved.

#182515
Jun 14, 2010 at 9:50am

Hello maxers,

– Pasted Max Patch, click to expand. –

Must be improved.

#182516
Jun 14, 2010 at 5:46pm

Nice one! Creative thinking wins again :) I was exploring the idea of using a funbuff early on, but for some reason didn’t get that far. I’ll try this out in place of the js’s I’m using and see if it works better.

You rock Pizza Olives! Thanks again :)

#182517

You must be logged in to reply to this topic.