Dynamics Compressor (Scriptnode Question)

In scriptnode, when I use the dynamics compressor (Treshold 25 & Ratio 3:1) , I get this in Plugin Doctor (Normally, as it's supposed to be).
But when I control a gain module with the same compressor's reduction analyser (same treshold and ratio); I am getting this:
My structure is this:
I tried to reduce the smooth value of the gain unit, but no luck. Volume goes extremely squeezed. Where am I mistaking? Any help would be appreciated.
HiseSnippet 2022.3oc6Zs0aaibEdnkFaKsIcy1lh1BTfptnO3EHqfnrkufhh0I9RfQiSzZ4j18IuiIGaMvTC4RNJwpE889yn+f5CEnO19Onuz+AsmyPRwgLzxLJWbb6J+f4bNmYlu4LmaCG1Oz2gGE4GRrZb7j.Nw5NzASjpg6LjIjjC1kXcO5.wn.OdqARQP.WQdzj.VTD2kXYU6wnTVMpSHjus2+5e9UOh4wjN7DR5euvW3vehXjPkQs+1+Vgm29LW9whQFRu11G33K2w2yeLfnZzNj.lyEry4Okghs.kXs3dtBke3.ESwiHV0eju6jAC8ekLV9WHhDm5wwF1jAv.ESdeeOWDwHUxNCEdt8SW4QDhEseldnVrd39zCEthozM0GHiVY8vTeXsvrfmsI75Tc3YY.u5wv6ynCbBEApLNH19D5AREO7LFrEXBqXYIV+U5N9f.RU6QrK36GBMl1gU5t9pOnU2s58E+561L6uyFKcTBeYKe4S8U7mIW4KZ9Ga1n4epYqhrN6rR4gSYnumGOrT1nEP3r53JxwiNkG9fVuj4MlOUPPUjWWSuZcsoofSrFvPPe4ARg5YAb4UsCPRTavSO+fcYJFtojPCjKfGpDHDr1k+RvZOdKpAcWdzEJ+.vd+01+.qHe2wdLUdSKzeJgAnCxsGhaTxHgZRl6x+9qduXuUU39Yz9Bkyvxw6BkfWPq89FuIdu2kt2YmwcTYfsNc+e+MiqZyDWUX9Qf7yAevQAgZYNAzcbvwv9jDOzxbZ+Gz61rEX0Fo.OfvVkz6V+lV6IOWH4scB4vpY2nfmxUuxO7hU97RD+yQO7o9Y.2.VH+X+9drIqDwvX8GACxCZcpmuyECD+A9q6bFDuJeDJwJ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cr9cHjOMPRECuIYArmQHDcz02AAbmUpf7Mxcdgyg0R2R28N+F9jBVKjzZBvHNcxQ7nTcsg1r+3S8DNoEukuOeJ84Q7Jzsq0ObgapjoMn8ZuV2tc2njxUSFt4J0k80k5JQjYisqor0BG9nf02xwmV091vwUsLv8UEl368htU5EMmG5iB0m8V6Akcv8p36TwFus2OzOJ8BLd3XWg+S7wNqQ48iozBI0BeW83as7JtKV32eqp2EaPkuK1ASjNGF+RRmdAT5a.53PnddT6YLUHLmlSNS9i.EMdYgl2E7.8KWbfhEpfg2bPNhiu6QdNZ6K7xtN3Q3RN983OhcY5idvbqGNSB6IcSaZUqxW8yavkHW+i5KQ9C2cPVqZv8Zt7rFoXL9qOXOHrfG3Knw3OD7bNiM1SkRsaNTdnuzOXnuDCMZZKoBEmetNHyTrW5BJ47oSob+sSOcXJo+7ee6m.4HYgEcGdCzE1UWWLq8qeZxwoagdus9ei6Nt1ss6N9ciI+xS+Bbzl7ONc5+AoeANOVWv1UDy+u7X1uZ6c4PhASkVRQKoD9lsKIqPbJ299drvhp7ZuqLmqWY6BbIc6wNFCEAp7aS.VaRb6Av2i1m8wfAQgOv.ZoefAK7V8AFbSLGe+GJw+W9gRLh4D5ehS7WmCFfdYMEv5WpqstA8PrcKaxKydO2cf5scEm33foD+RaBo79zcN5ypyQeVaN5Su4nOqOG8Yi4nOaNy9fGX3giU9ihiBBD5um9nlVVSOmkUMx+EvjU.jq


@SteveMohican I'll try to check this out today

@SteveMohican The max gain reduction should be the threshold I imagine. I can’t think of a way to make it efficient at the moment but I think the upcoming pma.node will help to handle such a scenario... Perhaps fiddling around with some add/sub/mul nodes can help but I’m not in front of my computer to test...
What if you just add a sub.node after or before the add.node, link it to the threshold and play with the sub min/max/skew? 
@dustbro said in Dynamics Compressor (Scriptnode Question):
@SteveMohican I'll try to check this out today
this would be great. I think this issue concerns all the developers who want to make sidechain filtered compressors.
@ustk said in Dynamics Compressor (Scriptnode Question):
@SteveMohican The max gain reduction should be the threshold I imagine. I can’t think of a way to make it efficient at the moment but I think the upcoming pma.node will help to handle such a scenario... Perhaps fiddling around with some add/sub/mul nodes can help but I’m not in front of my computer to test...
What if you just add a sub.node after or before the add.node, link it to the threshold and play with the sub min/max/skew?I tried multiplying, it doesn't work effectively and the compression curve doesn't looks normal too. But I will try sub node.

Has anyone found a solution?

I tried sub node but no luck unfortunately.... or at least I couldn't figured it out to use that node properly

I'm not sure what you are trying to achieve here. The weird curve might come from the fact that the scale of the gain knob is logarithmically, but I don't understand the intention of this patch.
Also the entire mod_chain node is unnecessary, just drag the compressor directly to the gain.

@ChristophHart said in Dynamics Compressor (Scriptnode Question):
I'm not sure what you are trying to achieve here. The weird curve might come from the fact that the scale of the gain knob is logarithmically, but I don't understand the intention of this patch.
Also the entire mod_chain node is unnecessary, just drag the compressor directly to the gain.
Ok.
Sidechain compression scheme is below. There is an analysis compressor that has a high pass filter before it. The purpose it to make compressor behave to high frequencies, we don't want the compressor to jump for bass frequencies. So we take the gain reduction information of this pre filtered compressor to modulate a gain unit (or compressor  I don't know if "compressor to compressor modulation" is possible). It is not a multiband compressor by the way, this is completely diffrent and it has been used tons of hardware units.
So because of that I used gain. But if it is possible, compressor to compressor would be much more awesome.

Ah ok, in that casey you might want to increase the HP frequency (in your patch it's 20Hz which doesn't do anything noticeable).
Then there are other things to watch out:
 16x oversampling is way way way overkill for this algorithm. Just because it's there it doesn't mean you should use it. You're not introducing much harmonics with this DSP algorithm.
 More importantly is the same advice I gave in the other thread: you need to split down the signal into smaller chunks to increase the update rate (and in this case you might even need to use the frame processing block because you want the compressor to be snappy). This will have a real impact on the sound  unlike the 16x oversampling which will just increase the CPU usage by 16. Right now your calling the gain factor update every 512 samples (or whatever your buffer size is). Considering the 16x oversampling, you even update the gain every 8192 samples!
 Again, connect the compressor directly to the gain, the indirection through the mod chain is unnecessary.
 Don't use the gain node here. You don't need the smoothing and you don't need the decibel conversion, which are the exact two things that make it different from the plain
math.mul
node, so please use that one instead as target node for the compressor's side chain signal. Also thegain2
node at the end of your analysis chain should be amath.clear
node  all it needs to do is to clear the signal.  Now to your original problem: you will need to change the range of the modulation to be inverted (and there's no need for a
core.pma
module here). Just right click on the compressor and swap the minimum and maximum values at the modulation connection properties. The modulation signal from the compressor module is the ducking amount, so you want this to be subtracted from a fixed value.  If you're end up with a frameprocessing, it's highly recommended to compile this node network to a C++ node, otherwise the performance will not be comparable to other effects with similar processing. The export is broken in the current version but the good news is that this patch should be 100% compatible with the new version.

@ChristophHart Thank you so much, I really appreciate that advise, I'll try these instructions
the good news is that this patch should be 100% compatible with the new version.
Looking forward to see it :)