Forums > Max For Live

How to replicate functionality using javascript LiveAPI?

May 08 2012 | 8:54 pm

I’m getting my feet wet with the js LiveAPI object but I can’t find a way to observe anything other than through the Max object.

Is there no way to hook up a callback to some sort of javascript observe function? I hope I’m missing something.

May 08 2012 | 9:50 pm

Hi Thijs,

Yeah you can


function watch_vol()
var foo = new LiveAPI(callback);

foo.path = "live_set tracks 0 mixer_device volume" = "value";


function callback(args)


May 08 2012 | 9:58 pm

Ah great! I misunderstood the constructor callback function.


Jul 11 2013 | 8:56 am

Is there a way to use the same callback function to observe the same parameter on different tracks?

For instance, I’d like to observe the ‘volume’ parameter in all tracks without having to define a different callback for each track. Is there a way to retrieve the track reference from the args in the callback function?

Jul 11 2013 | 10:48 am

You’ll need separate LiveAPI objects for things which have different ids in a live set


Jul 11 2013 | 11:30 am

Thanks for your reply Andrew. I understand I need different LiveAPI objects to register each observer for each track but my question is whether I can use the same callback function for each observer or do I need to create a different callback for each observer too.

For example:
var api1 = new LiveAPI(volumeChanged);
var api2 = new LiveAPI(volumeChanged);
var api3 = new LiveAPI(volumeChanged);
api1.path = "live_set tracks 0 mixer_device volume"
api2.path = "live_set tracks 1 mixer_device volume"
api3.path = "live_set tracks 2 mixer_device volume" = "value"; = "value"; = "value";

function volumeChanged(args)
// Right now only one argument is received, the value, thus we don’t know in which track the volume has changed.
// Ideally here the source object (volume in this case) could be passed as an argument so we could go through the canonical_path to find its track…

Jul 17 2013 | 5:29 am

you can use ‘this’ in the callback to determine which LiveAPI instance you have been called back with, e.g. to find out the id of the callback

Dec 21 2015 | 11:06 am

Does anyone know of any factors that might stop a js observer from observing?

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

Forums > Max For Live