Matching Gain Before And After Effects



  • Hello Hise People

    I'm Trying To Make The Gain Volume Matching To Where It Was Before Going Into The Fx Modules.
    For Example :

    Pre Gain Module ( It Was 0 dB)
    Eq ( In Eq It Lost 10 dB)
    Post Gain Module ( With Simple Gain Module Bring Back The Lost dB's )

    Is This Possible To Mix And Match?
    Thanks For Any Help



  • Aside from doing it manually (tedious), there might be a way with storing variables from something like Engine.getMasterPeakLevel() and Engine.getDecibelsForGainFactor() at different stages in the chain, then using those values to set the output gain dynamically... haven't tried it but so who knows 🤔

    Edit: use getCurrentLevel() not MasterPeak



  • It kinda works, but there's a volume spike when you first hit play. Chain looks like this:

    8ce98e11-201f-410c-85d6-1ea41c092d68-image.png

    Replace "Transformer" with whatever DSP you're using that's making the volume adjustment. Just make sure the InputLevel is before, and OutputLevel is after.

    
    const var InputLevel = Synth.getEffect("InputLevel");
    const var OutputLevel = Synth.getEffect("OutputLevel");
    
    //Create a timer object.
    
    const var t = Engine.createTimerObject();
    t.setTimerCallback(function()
    {
        //Reads the left channel of Input Gain:
        
    	var inputlevelL = InputLevel.getCurrentLevel(1);
    	inputlevelL = Engine.getDecibelsForGainFactor(inputlevelL);
    	
    	//Reads the left channel of whatever effect is causing level adjustment:
    
    	var affectedlevelL = Transformer.getCurrentLevel(1);
    	affectedlevelL = Engine.getDecibelsForGainFactor(affectedlevelL);
    	
    	//Calculates the difference between them (the amount of level adjusted):
    	
    	var leveldifferenceL = affectedlevelL - inputlevelL;
    	leveldifferenceL = 1-leveldifferenceL;
    	
    	//Uses the calculated difference to set the output gain.
    
    	OutputLevel.setAttribute(OutputLevel.Gain, leveldifferenceL);
    });
    
    //The lower the timer value, the more responsive the adjustment is (and the higher CPU):
    
    t.startTimer(20);


  • Oh Thank You @iamlamprey This Is Awesome
    I'll Give It A Try Right Now ❤ 🙂 Thank You Man



  • Very Good Script,
    Here, I Replaced the Transformer With Convolution Reverb,
    The result Is Not Very Undercontrol As You Said, It's Acts Very Unstable, And Glitchy 😞

    Snippet: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PLi4zoju36NkrcEC+r7jVBJ3M4L0gwvnw1IsGa0i4V1YhwZSJ2FsolkA5zhkS5z0DbFkGG+0iaVipn5xDingxECRESast0fgX82rhFE7pAIuTIhwJvmphBVWSDniSmtXmNLaDCzcOUUEckCLxQchcG.mKU.Oqv8pdsXJ+AyGuqLG7hdsya7Npeh08xpbkC107Z7qKayC+O5sYUKrbgIc3whhCgGLFJWxKuZzB5uywoFDRmx88TVfZPNgmsyb5.rIGKznZIBoxYc9qddXwqcliVzlG4Sln6q4Yb+eJAXS3wmN.9JdsneLDPbD1R.1J1ATrv+uiWO4QoQswqD4CUy5fCWHO2UzUAxFWVOVCn1.OvL3ewuQLqnG6NhYkwLscIWabJJr.xPQXpwz09i08r5vaJmQM4ISma3Y+wSA0roK1GcJb+oNx2LJNMLA1G38sSb716OBOlDQ1zw9n1CaBuuD6oKny.rm8.64qkDBlMozCYUsli2726TiFEi9SaYZznynhh4jXgitnIw6UsN5vetd0NOuwg6Wq9Qu9g3cAdBH61r4VGSG5DosyLWdDUuC49l+bEmPgHtstunw7zDpyCFO7bIc2G5fk2UMj08r5NcgORvWJh7khHeoHxmaEQtblK4hXdANXdtFi23qMiIOkhWv7A.GjZmUkEje3uNqOhX7Y9QDOzWgKuoTVrHYpItMDw5H3ZudNQrjSCI7aGo29roWUPkyk0aueCzHmqNsopToINXWyqRrnLWdmsLWSekLK4eOOi3ZeT+Jme3tR5pmM39ddH1BiwXVcv5X8oP7d2SRx1ilFpFSc5.9CDbQ7.Am4aGMbDfGT62Gj1XetFztJE1QTNkquyQPHPsir+1c1GiHoRzOAKounxY2Wrn8quwKCtD8oTxmGOkvpeF8TBejUQ4CwZDQ8khm6m8Ja5X4KXnf1M2z9eAuCziIUbLukHpmW4sJiM8Gvdtuu1ceyJNNyWmasD57cKgN2dIz4NKgN2cIz46WBc9gEpitXztoJQT1QQjPq5lW8z0sNmhQxlndm+CwOw2DC
    


  • Yeh the volume spikes are brutal, which I assume has to do with the limitations on timer rates. I'm messing around with a scriptnode version, I have an old build so I don't think I have the comparison node which might be necessary...



  • @iamlamprey
    Yeah, The Measurement And Limitation On Timer Kinda Make This Hard For Output Gain Level.
    It Works All The Time And Sometimes It Goes Too Down And Cuts The Signal's Volume.



  • Do you have access to the core.pma node in Scriptnode? I can't find it, pretty sure my build should have it



  • @iamlamprey No I Don't See That In The List
    Eidt: I'm At The Latest Commit
    Did Check My Previous Build, And No Such A Node "core.pma"
    @Christoph-Hart Is This Available core.pma?



  • If I can figure out how to subtract the value of one core.peak from another, I might be able to make a scriptnode version. But it would only affect things in the same scriptnode tree, not external effects... 😧

    decent chance im overcomplicating it as well



  • Ok getting somewhere... it's a bit jumpy but I think I can improve on it

    Probably all I can do for today since it's officially christmas in australia 🙂



  • @iamlamprey
    You're Doing Great Man 👏 Keep It Up
    And Merry Christmas 👏🥃💯🍓🍎🍅⭐



  • @Natan Merry Christmas! ☺


Log in to reply
 

8
Online

954
Users

3.4k
Topics

28.7k
Posts