free-audio / clap

Audio Plugin API
https://cleveraudio.org/
MIT License
1.76k stars 97 forks source link

Add sidechain flag to the audio port #262

Closed sadko4u closed 1 year ago

sadko4u commented 1 year ago

The audio port flags are pretty poor at this moment and define the main role and some 64-bit float capabilities. There could be a good idea to add the CLAP_AUDIO_PORT_IS_SIDECHAIN flag which will indicate this audio port as a default side-chain port. This could be a good hint to the DAW like Ardour to connect the corresponding audio port to the sidechain input of the track/bus.

baconpaul commented 1 year ago

I am in favor of this idea.

My only comment is that there’s no requirement you have one and only one sidechain so perhaps the constant would be better as audio port is primary sidechain rather than port is sidechain,

I think we should also add a comment that it is entirely possible to have a primary sidechain and no main input, surge today has that and it works just fine, but I think we would want to make it explicit if we add the constant.

abique commented 1 year ago

There can be one main port, and everything else is a side-chain isn't?

sadko4u commented 1 year ago

There can be one main port, and everything else is a side-chain isn't?

Nope. Consider the Spectrum analyzer x16: https://lsp-plug.in/?page=manuals&section=spectrum_analyzer_x16

The plugin has 16 inputs for audio analysis.

baconpaul commented 1 year ago

Yeah sidechain is a special type of non main input. Not all non main inputs are sidechain. And not all plugins with multiple inputs have sidechains.

I think main and primary sidechain are useful hints myself.

abique commented 1 year ago

So what would be the other kind of auxiliary inputs?

baconpaul commented 1 year ago

Just other audio in.

Maybe it’s a terminology thing. A sidechain means to me semantically “an extra input you use to replace some part of your signal path”. So like a sidechain in a compressor or maybe a modulator or carrier in a vocoder. But if I have a plugin which, say, takes up to 32 mono inputs and mixes them into a stereo field based on the modeled position of each source, I would say that has no side chains. (I might even say it has no main input but probably wouldn’t)

baconpaul commented 1 year ago

(Oh also I know there’s lots of thinking about audio rate cv but if arcv ends up as a tagged audio port that would also not be a sidechain)

Trinitou commented 1 year ago

There could be a good idea to add the CLAP_AUDIO_PORT_IS_SIDECHAIN flag which will indicate this audio port as a default side-chain port. This could be a good hint to the DAW like Ardour to connect the corresponding audio port to the sidechain input of the track/bus.

But if there are multiple plugins with a dedicated sidechain input on that track/bus, how does Ardour know which plugin it should auto-route the track's side-chain signal to? Or would it auto-route the signal to all plugins that promote a dedicated sidechain input to the host?

baconpaul commented 1 year ago

I think sidechain flag, like main, is a practical acknowledgement that most plugins which are fx are main in main out or main in sidechain in main out

clap allows any topology and requires no flags for anything and (say) a 32 inout compressor with 32 side chains would have no single main and no single sidechain.

so the way I think about this question is: would this hint help most sidechain topologies and break any irregular ones? I think the answe is yes

abique commented 1 year ago

I would then appreciate a PR with the new entry and its documentation adjustment.

abique commented 1 year ago

Because I don't have the vision and I don't see the need for this flag so I can't be the one to introduce it.