OSC API through Max

Learn about building and using Max for Live devices.
willrjmarshall
Posts: 87
Joined: Fri Apr 24, 2009 2:41 am

Re: OSC API through Max

Post by willrjmarshall » Thu Nov 12, 2009 8:02 pm

@mzed

I'm still too new to Max to be of much help. If you look at the Max for Live docs within Max, they have an API for the LOM, that should give you all the info you need.

Tone Deft
Posts: 24152
Joined: Mon Oct 02, 2006 5:19 pm

Re: OSC API through Max

Post by Tone Deft » Thu Nov 12, 2009 9:15 pm

I'm not up to speed on this level of coding but wanted to give a shout out to OSC for midi sync via the API.
In my life
Why do I smile
At people who I'd much rather kick in the eye?
-Moz

pukunui
Posts: 405
Joined: Thu Jan 29, 2009 10:26 pm
Location: Los Angeles

Re: OSC API through Max

Post by pukunui » Thu Nov 12, 2009 10:28 pm

My personal feeling about this type of endeavour is that an easier way to do it would be to build a big observer structure in js using callbacks for track creation, clip adding, device addition and what have you and take it from there. You could handle all the OSC in there as well, or push out [path, id] pairs.

Any attempt at a generalisation which ends up having to make a call to live.path any time something happens will end in tears, IME

-A

mzed
Posts: 44
Joined: Tue Sep 01, 2009 4:11 pm
Contact:

Re: OSC API through Max

Post by mzed » Fri Nov 13, 2009 12:16 am

Indeed. As much as I love string handling in Max, I'm finding this kind of javascript has more potential:

Takes a message like: "OSC /live_set/tracks/0/mixer_device/volume 0.5" and forwards it to the appropriate API address.

mz

javascript below
-=-=-=-=-

outlets =1 ;

var vpattern = "/";
var vmodifier = "g";
var vregexp = new RegExp(vpattern,vmodifier);
z = " ";

var api = new LiveAPI(this.patcher);


function OSC(address,value)
{
var r = address.replace(vregexp,z);
r = trimString(r);
api.path = (r);
api.set("value", value);
name = api.getstring("name");
post(name,"has been set to",value,".\n");

outlet(0,r);
}

function trimString (str) {
str = typeof this.valueOf() == 'string' ? this : str;
return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}

willrjmarshall
Posts: 87
Joined: Fri Apr 24, 2009 2:41 am

Re: OSC API through Max

Post by willrjmarshall » Fri Nov 13, 2009 12:40 am

The LiveAPI implementation can be seen at http://monome.q3f.org/wiki/LiveOSC

There are some things we could improve on, but it gives you all and idea.

t0gg1e4u
Posts: 10
Joined: Fri Mar 13, 2009 12:28 pm

Re: OSC API through Max

Post by t0gg1e4u » Mon Nov 16, 2009 10:59 pm

Are there more infos available regarding the api for js?

Post Reply