HISE Logo Forum
    • Categories
    • Register
    • Login

    Matching Gain Before And After Effects

    Scheduled Pinned Locked Moved Scripting
    68 Posts 10 Posters 4.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ?
      A Former User
      last edited by A Former User

      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

      1 Reply Last reply Reply Quote 1
      • ?
        A Former User
        last edited by

        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);
        1 Reply Last reply Reply Quote 1
        • NatanN
          Natan
          last edited by

          Oh Thank You @iamlamprey This Is Awesome
          I'll Give It A Try Right Now <3 :) Thank You Man

          1 Reply Last reply Reply Quote 0
          • NatanN
            Natan
            last edited by Natan

            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:

            HiseSnippet 1591.3oc6X80aSbDD+tjbUXCAAHTUebEpO3HERro.shpJRh+C31DhUrAJOgVe2X6Eta2q6smSiP7Ner5a80J0uHn9Enc18r8s1wXRsTP.hK4Auye182L6ryL61RJ7gjDgzwsPmShAG2K409DtZP0ATF2oYMG2K6c.MQARRFo8NIllj.ANttq9.MA2Bq4X9d682iFR49PNIGmmHX9v9rHlJmZqc9EVXXCZ.zgEYI8s2ooufWUDJRQ7rpWYmXp+Ko8gGQ0hshmi6WUOfoDx1JpBRbbWaOQvIsGHNlmI+SXIrtgfdPEm13DkQtgHLPiX8ucpNfEFzZrcm33350J2KrZlW35dGvBXSnm6MthgAIWCa+g6JKBdUrgW44BuJyCdtVvasL3cUu19RVrJmiFaWzqIG2n5Qws.aXkIqyJ+yZdUEnDb0VQzWBMj3fIZT5tkKuI4NkKuwOtdww+gaGIJxPpjzjGmp1GFBgjehXhP1pOnp2qG3qJcibt2PqdtZGlpVjdVrmQwNRJOomPFgAdyQQK12HCvaucUIftcBknXZsDceAJ5VSaFJbxpy6y3vV9Fw0QfxCMhVROQpsR.kgXUZXXWL9qTuTtuhI3k1X8huZ8hD7a6sOBnAID0.fDB8TD+ATNGsQQuLOEQez3dYBudwB5klooGpM08QPj6wzlU0ToD2VLiKUQiiBSK9HLihVC7YcgvjFBodMZP8w.tRVRazF+eQX73AnoODcRfweRXIDeZZBi2mXlDBM3EoIpHDS2S6.MF.0HKDLATVaBuCi3Tp79rioUH2TvMC+zP8oJi8DvP4vEyGHcA0w.v0jiHkzLoQhTtRal11BDrw8xlMssX3jOKZnMCVuo8FlFGyQkJ2bVhS.7iSFAU+wHOvF0JAAiyLBHLmAH8QmfIXsf0gBcv3tJkj0MUAkrYn8YadJyP6vd83yCcza7hiw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gvdtuu1ceyJNNyWmasD57cKgN2dIz4NKgN2cIz46WBc9gEpitXztoJQT1QQjPq5lW8z0sNmhQxlndm+CwOw2DC
            
            1 Reply Last reply Reply Quote 0
            • ?
              A Former User
              last edited by

              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...

              NatanN 1 Reply Last reply Reply Quote 1
              • NatanN
                Natan @A Former User
                last edited by

                @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.

                1 Reply Last reply Reply Quote 0
                • ?
                  A Former User
                  last edited by

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

                  NatanN 1 Reply Last reply Reply Quote 0
                  • NatanN
                    Natan @A Former User
                    last edited by Natan

                    @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?

                    1 Reply Last reply Reply Quote 0
                    • ?
                      A Former User
                      last edited by

                      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

                      pelleP 1 Reply Last reply Reply Quote 1
                      • ?
                        A Former User
                        last edited by A Former User

                        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 :)

                        NatanN 2 Replies Last reply Reply Quote 1
                        • NatanN
                          Natan @A Former User
                          last edited by

                          @iamlamprey
                          You're Doing Great Man πŸ‘ Keep It Up
                          And Merry Christmas πŸ‘πŸ₯ƒπŸ’―πŸ“πŸŽπŸ…β­οΈ

                          ? 1 Reply Last reply Reply Quote 0
                          • ?
                            A Former User @Natan
                            last edited by

                            @Natan Merry Christmas! ☺

                            1 Reply Last reply Reply Quote 1
                            • NatanN
                              Natan @A Former User
                              last edited by

                              @iamlamprey
                              Mate, Have You Made This More Stable, And Smooth?

                              ? 1 Reply Last reply Reply Quote 0
                              • ?
                                A Former User @Natan
                                last edited by

                                @Natan Well for one it doesn't need a 16x oversample node 😧

                                You could try playing around with the Smoothing setting for the gain, or wrapping either the gain, the core.peak, or both in one of the fixX_block nodes, or a frameX node.

                                Not too sure but

                                CasmatC 1 Reply Last reply Reply Quote 1
                                • CasmatC
                                  Casmat @A Former User
                                  last edited by

                                  @iamlamprey @Natan (anyone else!)
                                  Hey!

                                  Was wondering if anyone had any working version of this, I'm trying to replicate the same thing for a saturator, and it's not really working out..

                                  Thanks!

                                  i make music

                                  CasmatC 1 Reply Last reply Reply Quote 0
                                  • CasmatC
                                    Casmat @Casmat
                                    last edited by

                                    Yarrr matey, which hise scallywag can save my day?? (bump!)

                                    i make music

                                    ustkU 1 Reply Last reply Reply Quote 0
                                    • ustkU
                                      ustk @Casmat
                                      last edited by ustk

                                      @Casmat Since the phase, the frequency content, or the "fullness" (reverb delay) of the sound will be severely modified by whatever effects you are using, the resulting gain is very hard (another way to say impossible) to predict. Therefore you need to compensate for this in each effect by ear, and probably automate it when the parameters are changing.
                                      So basically it will be a gain module/node at the end of each chain that react to different parameter in a "weighted" manner

                                      Can't help pressing F5 in the forum...

                                      CasmatC 2 Replies Last reply Reply Quote 0
                                      • CasmatC
                                        Casmat @ustk
                                        last edited by

                                        @ustk ahh ok! Thanks!

                                        i make music

                                        1 Reply Last reply Reply Quote 0
                                        • CasmatC
                                          Casmat @ustk
                                          last edited by

                                          @ustk i have this chorus module which is getting cloned 4 times, this creates a massive gain increase and since it’s cloned 4 times, is there a way to accurately reduce that gain?

                                          Thanks!

                                          i make music

                                          LindonL 1 Reply Last reply Reply Quote 0
                                          • LindonL
                                            Lindon @Casmat
                                            last edited by

                                            @Casmat said in Matching Gain Before And After Effects:

                                            @ustk i have this chorus module which is getting cloned 4 times, this creates a massive gain increase and since it’s cloned 4 times, is there a way to accurately reduce that gain?

                                            Thanks!

                                            @ustk just told you what to do...

                                            HISE Development for hire.
                                            www.channelrobot.com

                                            CasmatC 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            17

                                            Online

                                            1.8k

                                            Users

                                            11.9k

                                            Topics

                                            104.0k

                                            Posts