Binding to Plugin Parameters by Id and Index

Cantabile has long supported binding to plugin parameters when binding directly to a specific plugin instance.

For example, in this screenshot you can see the parameters of the plugin 4Front R-Piano shown in the list of available binding points:

This works when binding directly to a specific plugin instance, but doesn't work when you bind to a plugin using the "Plugin By Index / Name" bindable.  In the following screen shot the I've selected to bind to the first plugin in the song and you can see the plugin parameters are no longer shown as available binding points.

The reason the parameters aren't shown is because the plugin instance can change if things are re-ordered.  Also, from the background rack you might even select to bind to a plugin instance that doesn't exist in some songs - so the list of parameters just isn't available.

Normally this isn't an issue because usually it doesn't make sense to bind to a plugin parameter when you don't know what type of plugin might be loaded.

However, there are cases where it can be handy to create such a binding so there are now two new binding points to support this - "Parameter by Id" and "Parameter by Index".

For example, to bind to the 3rd parameter of the 1st plugin in the currently loaded song you could do this:

Both binding points (by Id and by Index) are also available as source binding points.

"Id" vs "Index"

So you might be wondering what's the difference between a parameter Id and parameter Index.

  • The Index is the position in the list.  Indices can be either one or zero based depending on Options -> General -> Formatting -> Program Numbers -> One or Zero based.
  • The Id is a number assigned to the parameter by the plugin developer and is the number shown in Cantabile's parameter editor.

Often the Index and Id will be the same, or perhaps off by one as with 4Front Piano.  eg: the first parameter Decay has index 1 and id 0.

But for other plugins, the difference between Index and Id is much more obvious.  Take a look at HLConvolver - those long numbers are the parameters ids:

Whether you use Index or Id is up to you and might depend on exactly how you're trying to use the binding.

Network API

One new possibility that these binding points provide is the ability to use the network API to read and write plugin parameters which wasn't possible before.

For reference here's a couple of code examples using the Javascript API :

Watching a parameter by id:

// Watch parameter with id 2125488016 of the second plugin in the song
C.bindings4.watch(
    "indexedPlugin",
    "parameterById", 
    { rackIndex:0, pluginIndex: 1 },
    { parameterId: 2125488016 },
    (value) => console.log(value)
)

Watching a parameter by index:

// Watch the second parameter of the second plugin in the song
// Note via the network api, indicies are always zero based.
C.bindings4.watch(
    "indexedPlugin",
    "parameterByIndex", 
    { rackIndex:0, pluginIndex: 1 },
    { parameterIndex: 1 },
    (value) => console.log(value)
)

Set a parameter by index:

// Set the first parameter of the first plugin in the song to 0.5
C.bindings4.invoke(
        "indexedPlugin",
        "parameterByIndex", 
        0.5,
        { rackIndex:0, pluginIndex: 0 },
        { parameterIndex: 0}
    );
    

Available now in build 4170 and later.