Forum
    • Categories
    • Register
    • Login

    Rms type or Cosine type Crossfade Curves

    Scheduled Pinned Locked Moved Scripting
    16 Posts 4 Posters 117 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.
    • J
      Jeetender @David Healey
      last edited by

      @David-Healey no i did not, but the thing is there, i still have to balance between the send or wet with Dry. there is no direct wet dry balance in the modules...

      David HealeyD griffinboyG 2 Replies Last reply Reply Quote 0
      • David HealeyD
        David Healey @Jeetender
        last edited by

        @Jeetender What about setting the Gain of the SimpleGain where you want it and using a CC modulator to control the actual value (you can connect the Default value knob to a UI knob, you don't actually need to use a CC). Then you could set any shape you want using the modulation tables.

        611b63e8-5067-43ea-baa5-1cd17ee08750-image.png

        Free HISE Bootcamp Full Course for beginners.
        YouTube Channel - Public HISE tutorials
        My Patreon - HISE tutorials

        J 1 Reply Last reply Reply Quote 0
        • griffinboyG
          griffinboy @Jeetender
          last edited by

          @Jeetender

          Wet / Dry balance is done using a sin / cosine curve usually.
          You don't need to do any RMS calculations for an equal power curve.

          1 Reply Last reply Reply Quote 0
          • griffinboyG
            griffinboy @Jeetender
            last edited by griffinboy

            @Jeetender

            This is pseudo code.
            It's something like this

            // Equal-power wet/dry crossfade (pseudocode)
            
            // knob range
            value = 0 to 127
            
            // normalize
            t = value / 127.0
            
            
            // equal-power law
            // sin/cos keep total power constant
            wet_lin = sin(t * PI * 0.5)
            dry_lin = cos(t * PI * 0.5)
            
            
            // linear → dB
            // dB = 20 * log10(gain)
            // log10(x) = ln(x) / ln(10)
            
            wet_db = 20 * ln(wet_lin) / ln(10)
            dry_db = 20 * ln(dry_lin) / ln(10)
            
            
            // clamp near zero (avoid -inf)
            if (wet_lin < 0.00001) wet_db = -100
            if (dry_lin < 0.00001) dry_db = -100
            
            
            // apply
            WET.Gain = wet_db
            DRY.Gain = dry_db
            
            
            
            /*
            Behaviour:
            
            t=0
            dry=1.0  (0 dB)
            wet=0.0  (-inf)
            
            t=0.5
            dry≈0.707 (-3 dB)
            wet≈0.707 (-3 dB)
            
            Summed signal power stays constant across the crossfade,
            so the centre position does not sound quieter.
            
            

            This is the kind of question that AI can help you understand.
            Ask chat gpt about it until you get why it works!

            J 1 Reply Last reply Reply Quote 0
            • J
              Jeetender @David Healey
              last edited by

              @David-Healey this works good but still the same issue, at 50% the volume is not constant.

              said in Rms type or Cosine type Crossfade Curves:

              @Jeetender What about setting the Gain of the SimpleGain where you want it and using a CC modulator to control the actual value (you can connect the Default value knob to a UI knob, you don't actually need to use a CC). Then you could set any shape you want using the modulation tables.

              611b63e8-5067-43ea-baa5-1cd17ee08750-image.png

              David HealeyD 1 Reply Last reply Reply Quote 0
              • David HealeyD
                David Healey @Jeetender
                last edited by

                @Jeetender said in Rms type or Cosine type Crossfade Curves:

                this works good but still the same issue, at 50% the volume is not constant.

                Have you used an equal power curve?

                Free HISE Bootcamp Full Course for beginners.
                YouTube Channel - Public HISE tutorials
                My Patreon - HISE tutorials

                1 Reply Last reply Reply Quote 0
                • J
                  Jeetender @griffinboy
                  last edited by

                  @griffinboy chatgpt or other bots aren't familiar with HISE coding yet i believe.. they just get confused with parameters.

                  said in Rms type or Cosine type Crossfade Curves:

                  @Jeetender

                  This is pseudo code.
                  It's something like this

                  // Equal-power wet/dry crossfade (pseudocode)
                  
                  // knob range
                  value = 0 to 127
                  
                  // normalize
                  t = value / 127.0
                  
                  
                  // equal-power law
                  // sin/cos keep total power constant
                  wet_lin = sin(t * PI * 0.5)
                  dry_lin = cos(t * PI * 0.5)
                  
                  
                  // linear → dB
                  // dB = 20 * log10(gain)
                  // log10(x) = ln(x) / ln(10)
                  
                  wet_db = 20 * ln(wet_lin) / ln(10)
                  dry_db = 20 * ln(dry_lin) / ln(10)
                  
                  
                  // clamp near zero (avoid -inf)
                  if (wet_lin < 0.00001) wet_db = -100
                  if (dry_lin < 0.00001) dry_db = -100
                  
                  
                  // apply
                  WET.Gain = wet_db
                  DRY.Gain = dry_db
                  
                  
                  
                  /*
                  Behaviour:
                  
                  t=0
                  dry=1.0  (0 dB)
                  wet=0.0  (-inf)
                  
                  t=0.5
                  dry≈0.707 (-3 dB)
                  wet≈0.707 (-3 dB)
                  
                  Summed signal power stays constant across the crossfade,
                  so the centre position does not sound quieter.
                  
                  

                  This is the kind of question that AI can help you understand.
                  Ask chat gpt about it until you get why it works!

                  griffinboyG 1 Reply Last reply Reply Quote 0
                  • griffinboyG
                    griffinboy @Jeetender
                    last edited by

                    @Jeetender

                    Right but the math works the same way.
                    All you need to do is find the right hise functions in the API for the math calls.

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

                      @Jeetender eaiest way is ro use a scriptnode network and a xfade module...

                      HISE Development for hire.
                      www.channelrobot.com

                      J 1 Reply Last reply Reply Quote 0
                      • J
                        Jeetender @Lindon
                        last edited by Jeetender

                        @Lindon said in Rms type or Cosine type Crossfade Curves:

                        @Jeetender eaiest way is ro use a scriptnode network and a xfade module...

                        Yes, but iam not using DspNetwork. just trygin sumthing with the modules only.

                        @griffinboy the script is ok, the knob is linear from min 0 to max 1, it only moves either knobs a few dbs +/- . I dont know, my tabs panels were working last night and now the panels wont change with buttons..

                        It did work with a macro control, but still the curves

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

                        23

                        Online

                        2.2k

                        Users

                        13.5k

                        Topics

                        117.4k

                        Posts