Calling Device Function that expects DeviceParameter argument

Jake McLain's icon

I'm working on a patch that revolves around Ableton's Wavetable device, and need a way to set the modulation matrix programmatically using the js object. From the Live Object Model docs for WavetableDevice, I've discovered some functions attached to the device. I've had no issues setting parameters (using DeviceParameter) or setting the properties attached to the WavetableDevice.

My issue is that I can't figure out the syntax that the add_parameter_to_modulation_matrix function is expecting. The docs describe Parameter: parameter_to_add [DeviceParameter], but I am receiving syntax errors.

I've tried passing the following as arguments:

- Live object_id for the parameter to be added

api.call("is_parameter_modulatable", "parameters " + filterFreqParamId)
or
api.call("is_parameter_modulatable", filterFreqParamId)


- param_index on the device (eg. 26 for Filter Freq 1)

api.call("is_parameter_modulatable", "parameters " + filterFreqParamIndex)
or 
api.call("is_parameter_modulatable", filterFreqParamIndex)


- passing the object as a new LiveAPI instance

var paramApi = new LiveAPI("live_set view selected_track devices " + wavetableIndex + "parameters " + filterFreqParamIndex);
api.call("is_parameter_modulatable", paramApi);



- full path

api.call("is_parameter_modulatable", "live_set view selected_track devices " + wavetableIndex + " parameters " + filterFreqParamIndex)

All of these return an error, such as jsliveapi: Invalid arguments: 'is_parameter_modulatable parameters 26'

What is the correct way to pass a DeviceParameter as an argument to a function using the JS Live API like this?

tyler mazaika's icon

It looks like you tried basically every rational guess except for this one:

api.call("is_parameter_modulatable", "id", paramApi.id)

Maybe it is helpful to think of how you'd write the analogous code in Max, where the syntax would be: call is_parameter_modulatable id <nn> .

Jake McLain's icon

That did the trick! Many thanks Tyler.

Marking as resolved.