Mono plugin with side-chain
-
@ustk How do you add a sidechain to a plugin?
-
@David-Healey Well this is new to me so not very clear yet.
But the old trick was to add more channels in the the routing matrix and route them the way you want.Now on top of this there are extra proc:
HISE_NUM_FX_PLUGIN_CHANNELS=4which is the normal num channel + the sidechain channels
And
HISE_SIDECHAIN_CHANNEL_LAYOUT=1which I didn't know about until tonight...I'll try tomorrow to actually export a test plugin and see how it goes...
-
@ustk what does HISE_SIDECHAIN_CHANNEL_LAYOUT=1 do?
-
@JC Claude gives a decent definition:
HISE_SIDECHAIN_CHANNEL_LAYOUTchanges the bus layout of an exported FX plugin so the DAW sees a dedicated sidechain input. There's exactly one place it's used, ingetHiseBusProperties()athi_core/hi_dsp/plugin_parameter/PluginParameterProcessor.cpp:610:- With the flag defined: the plugin declares three buses — a main stereo Input, a second stereo input bus named Sidechain, and a stereo Output. DAWs recognize the named sidechain bus and offer their normal sidechain routing UI for it (Live's "Sidechain" chooser, Logic's side chain menu, etc.). The sidechain signal arrives in HISE as channels 3/4 of the processed buffer.
- Without it (default): the FX plugin instead declares
HISE_NUM_FX_PLUGIN_CHANNELSworth of paired stereo Input n/Output n buses — a generic multichannel layout where extra inputs aren't labeled as sidechain, which many hosts won't expose as sidechain routing at all.
A few practical notes:
- It only matters in
FRONTEND_IS_PLUGINbuilds (exported FX plugins, i.e. ProjectType "FX plugin"). It has no effect on instrument plugins, standalone builds, or the HISE IDE, and it's bypassed entirely ifHI_SUPPORT_MONO_CHANNEL_LAYOUTorHISE_MIDIFX_PLUGINis active. - The guard is
#ifdef, not#if— so defining it at all enables it, evenHISE_SIDECHAIN_CHANNEL_LAYOUT=0. Leave it out entirely to disable. - You'd typically set it via ExtraDefinitions in the project settings so it gets baked into the exported plugin.
-
@dannytaurus
So if I understand this cortect, it's only for stereo plug-ins?If we have HI_SUPPORT_MONO_CHANNEL_LAYOUT enabled, we have to compile two versions of our plug-in?
One stereo with sidechain and one mono without sidechain?
-
@Oli-Ullmann Yes, that's why I've made a patch and hopefully a PR soon.
-
@ustk What's your intention behind mono compatibility? Is it for a specific DAW?
And are you looking for mono sidechain input, or stereo?
-
@ustk I’m away from my system, but i did this a few years back (mono and stereo with sidechain support for VST3/AU/AAX). I had to modify the HISE source code at the time, perhaps this is built in now.. Once I have a moment I’ll share with you the process ;)
-
@dannytaurus said in Mono plugin with side-chain:
@ustk What's your intention behind mono compatibility? Is it for a specific DAW?
Simply for mono tracks like compressing bass for instance where you might need sidechain with the kick
And are you looking for mono sidechain input, or stereo?
In the end I think I just need to "monoize" the sidechain if it's forced stereo with mono plugins. I still have to investigate this, but it's not crucial as long as a mono track goes through the first SC channel... The ideal is to have the possibility to connect either mono or stereo SC no matter if the plugin is inserted on a mono or stereo track.
@HISEnberg Nice! Claude patched Hise for me, I am testing it in the afternoon...
If yours was made a few years ago then it might not account for the existence ofHISE_SIDECHAIN_CHANNEL_LAYOUT -
Claude said:
Main bus Sidechain Host buffer SC lands at Internal scratch mono mono 2 ch buf 1 [m0][m0][sc0][sc0] mono stereo 3 ch buf 1–2 [m0][m0][scL][scR] stereo mono 3 ch buf 2 [L][R][sc0][sc0] stereo stereo 4 ch buf 2–3 [L][R][scL][scR] either none — — ch2/3 silentSo a mono-track instance sidechained from a stereo source works fine: the mono main is duplicated across ch0/1 (HISE renders internally in stereo regardless) and only channel 0 is copied back out, while the stereo sidechain keeps its L/R on ch2/3. A mono sidechain gets duplicated. The network always sees one fixed layout — no mode-dependent logic anywhere.
Stereo sidechain detection is genuine, not left-channel-only. envelope_follower::processFrame takes max(abs(s)) across all channels of the frame, so it detects the louder of L/R.
I say:
All good