HISE Logo Forum
    • Categories
    • Register
    • Login

    Gain Reduction Meter on a Faust compressor

    Scheduled Pinned Locked Moved Unsolved General Questions
    scriptnodefaustmeters
    15 Posts 7 Posters 617 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.
    • M
      Mighty23
      last edited by

      1964cc54-5f03-432b-a8f7-1b2956856dac-image.png

      I have a Compressor made in FAUST where I display the Gains with the graphs, how can I display the gain reduction on the UI?

      HiseSnippet 3302.3oc6Zjrbabbc.oFYAHKujRtRxstX4CC.A.w.QsXIyHJwEIlHtTBRxxURJlFyz.XBGLyjdZPAZWLmxg7K3pxg7Gjy4lq7EjOAmpxGf+Cbdut6YC.jhhdIRtLYQRzus9s18qa1rwBVfKyc+3.unHlvvnz76wCcXwwgbiRkexQQLiRusYmiBDCVa.0KvXq0MJ8NlaSiELNQA59GEQiiYtFkJM+CP.kJeAC4We8cuO0mF3vx.YX7rPOG1i7F5Ixft2p+FOe+Motrm3MLG0Ku5VNgAqE5GNBzm4MaYDQcNf1msCEIaNSiRWbCWOQHuifJXwFktv8CcOpyfvWDnn+Ydwdc8Y3.aiNffTf2Lz2E0XDpwZC77cSs6XvKXlyKLuxKbUys8b8Rgm4MdOIBRFG48Gklqn5MeA0yNu50Jm5MCUpTNU5BJU58M63v8hDYXP84xlaE.AmdTvsmWUTzZL2erh4Zg.EAhlCoGv1jCCR4vpcqV0IvupdmqTI46.vYGCNdF4Yi1lATdkJe9UpTdoZ0HqwYngQnjHF8.xPDaS.WM7mxOMFBU2l7.uCYDOAPDm0iwYPBAQDBCGF5NxmQrXdhAP5TLllQB4DVudLGQ0LAskf3GFdPLoKKVPFE6EzGX+Edt.8z.Wx.lW+AB..Ld3HegWDH1vdjkkhn7ZihEgC89LXZGvHNxzoXsXPHwJ2HMf4qwR1xMFYcI3WdA9dALRuQANBuv.hizl0tBKz4TmLtN4np.sneorenC0G0t9L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kjRCKPXXtqO9JuPgwqtDuhrj7ykOSJIBU3AlkAvrrO72tzl9xFQa61EFZseiz7sEwLmjvSqpRgjSd3WCrFW+HbV6Ua7hvb1qZsizzP5AfsF+wGUsVe5hVi+UqfeheGxw2Ik89zo7KpzNz4jRDeJhzoSITokXTh0ujEp4KpxUS0e7CdAV1ZlPoZ2HZwnZxBy6T4XkCWdUTnScD9jjvDGJAeLy9rjLH0ZJIjnVw.bp3GtMIIb.eTl.CwSqbIzUUtb2tsUd87AHDuRZRm.5aIi0xIIyrKk2mSiFXsfN4Wl4CofUSMfswoU++eqh9uV904nfs56WyuN3RqwqVXp22m0SjTskZZ9ZeU+84x2.9j34o3wJDFt.F5qURqdBaIDgIeJTX5Y9xupPRehLpkGglStjSovdEX836XX7+nwXVZI
      

      Free Party, Free Tekno & Free Software too

      griffinboyG A 2 Replies Last reply Reply Quote 0
      • griffinboyG
        griffinboy @Mighty23
        last edited by

        @Mighty23

        A global cable can allow you to get the modulation data onto the Ui. From there a panel can use the global cable to draw whatever you want, or set the image if you are using a filmstrip animation.

        There is a global cable node in scriptnode which will send it out into the global cable network.
        You also need to declare the cable on the Ui.
        It's been a while since I've done it.

        1 Reply Last reply Reply Quote 0
        • A
          aaronventure @Mighty23
          last edited by

          @Mighty23 when you make a graph, it creates an output cable like that? what does the faust code for that look like?

          M Christoph HartC 2 Replies Last reply Reply Quote 0
          • M
            Mighty23 @aaronventure
            last edited by

            @aaronventure
            the full code is in the snippet in the main post. inside Script FX1 there is the faust node.

                // Add gain reduction meters to the UI
                gainReductionLeft = gain_reduction(l) : vbargraph("Gain Reduction Left", -60, 0);   // Left channel
                gainReductionRight = gain_reduction(r) : vbargraph("Gain Reduction Right", -60, 0);  // Right channel
            };
            

            Free Party, Free Tekno & Free Software too

            U 1 Reply Last reply Reply Quote 1
            • U
              udalilprofile @Mighty23
              last edited by

              @Mighty23
              Hello. Were you able to solve the problem? What compressor are you using?

              1 Reply Last reply Reply Quote 0
              • Christoph HartC
                Christoph Hart @aaronventure
                last edited by

                @aaronventure the vbargraph UI element in Faust translates to a mod output.

                T 1 Reply Last reply Reply Quote 0
                • M
                  Mighty23
                  last edited by

                  @udalilprofile @aaronventure

                  import("stdfaust.lib");
                  
                  /* Controls */
                  comp_group(x) = hgroup("1-compression", x);
                  env_group(x)  = vgroup("2-envelop", x);
                  gain_group(x) = vgroup("3-gain", x);
                  link_group(x) = vgroup("4-channel linking", x);
                  
                  // Controls
                  ratio     = comp_group(nentry("ratio", 2, 1, 20, 0.1));
                  threshold = comp_group(nentry("threshold", -20, -96, 10, 0.1));
                  knee      = comp_group(nentry("knee", 3, 0, 20, 0.1));
                  attack    = env_group(hslider("attack [unit:ms]", 2, 0, 1000, 0.1) : /(1000)) : max(1/ma.SR);
                  release   = env_group(hslider("release [unit:ms]", 500, 0, 10000, 1) : /(1000)) : max(1/ma.SR);
                  makeup_gain = gain_group(hslider("makeup gain", 0, -96, 96, 0.1));
                  
                  // Control for channel linking  - stereo vs dual mono.
                  channel_link = link_group(hslider("channel link", 100, 0, 100, 1) : /(100));
                  
                  // Envelope detector
                  t = 0.1;
                  g = exp(-1/(ma.SR*t));
                  env = abs : *(1-g) : + ~ *(g);
                  
                  // Compression function 
                  compress(env) = level*(1-r)/r
                  with {
                      level = env : h ~ _ : ba.linear2db : (_-threshold+knee) : max(0)
                      with {
                          h(x,y) = f*x+(1-f)*y with { f = (x<y)*ga+(x>=y)*gr; };
                          ga = exp(-1/(ma.SR*attack));
                          gr = exp(-1/(ma.SR*release));
                      };
                      p = level/(knee+0.001) : max(0) : min(1);
                      r = 1-p+p*ratio;
                  };
                  
                  // Gain computer for a single channel
                  gain_computer(x) = env(x) : compress : gain : +(makeup_gain) : ba.db2linear
                  with {
                      gain(x) = attach(x, x : gain_group(hbargraph("gain", -96, 0)));
                  };
                  
                  // Gain reduction calculation (in dB)
                  gain_reduction(env) = env : ba.linear2db : (_ - compress(env)) : min(0);
                  
                  // Main process
                  process(l,r) = (gl*l, gr*r)
                  with {
                      g_left = gain_computer(l);
                      g_right = gain_computer(r);
                      g_linked = max(g_left, g_right);
                      
                      gl = g_left*(1-channel_link) + g_linked*channel_link;
                      gr = g_right*(1-channel_link) + g_linked*channel_link;
                      
                      
                      gainReductionLeft = gain_reduction(l) : hbargraph("[5]Gain Reduction Left[style:numerical]", -60, 0);
                      gainReductionRight = gain_reduction(r) : hbargraph("[6]Gain Reduction Right[style:numerical]", -60, 0);
                  };
                  

                  @udalilprofile said in Gain Reduction Meter on a Faust compressor:

                  Hello. Were you able to solve the problem? What compressor are you using?

                  I'm still trying, as soon as I can get a decent version I'll post a snippet.

                  Free Party, Free Tekno & Free Software too

                  U 1 Reply Last reply Reply Quote 0
                  • M Mighty23 marked this topic as a question on
                  • U
                    udalilprofile @Mighty23
                    last edited by

                    @Mighty23 thnx)

                    1 Reply Last reply Reply Quote 0
                    • T
                      trummerschlunk @Christoph Hart
                      last edited by

                      @Christoph-Hart How exactly would I access the 'mod output' of a vbargraph UI element?
                      My goal is to simply put a meter from my faust code on the interface.

                      A 1 Reply Last reply Reply Quote 0
                      • A
                        aaronventure @trummerschlunk
                        last edited by aaronventure

                        @trummerschlunk Right now you can't because the mod output goes away once you compile the node and you can only use a compiled Faust node within ScriptNode.

                        Link Preview Image
                        [Engine/ScriptNode/Faust] Compiling a Faust node with vbargraph outputs doesn't preserve them in the compiled node · Issue #619 · christophhart/HISE

                        If you use vbargraph in Faust, it will create a cable output in the node, but the cable outputs will not be present on the compiled node. something = 0.3; somethingElse = 0.5; intermediary = something * somethingElse : vbargraph("[0]Cabl...

                        favicon

                        GitHub (github.com)

                        But to answer your question, you would just pass your GR through vbargraph.

                        Let's say you're calculating it separately so

                        gainReduction = gain reduction math here : vbargraph("GainReduction",0,1);
                        

                        Link Preview Image
                        Faust Syntax - Faust Documentation

                        favicon

                        (faustdoc.grame.fr)

                        T 1 Reply Last reply Reply Quote 0
                        • T
                          trummerschlunk @aaronventure
                          last edited by

                          @aaronventure so I understand correctly: no workaround?

                          A 1 Reply Last reply Reply Quote 0
                          • A
                            aaronventure @trummerschlunk
                            last edited by

                            @trummerschlunk depends on what you're metering. If it's just the gain reduction, you can have a peak node before the faust node and another right after, subtract these to get the difference (do it in the modchain so that it doesn't affect your audio signal) and there's your gain reduction.

                            If you're metering something else, you can do one of two things:

                            • run a multichannel scriptnode (4 channels for example) with a 4 channel faust effect and simply output whatever you're metering to the other two channels, get them specifically with a multi node (to separate the channels) and use that in your interface
                            • create another version of your faust effect where you're outputting whatever your metering and just connect it to the same parameters as your main faust effect (keep in mind that, since you're gonna be doing this in modchain, you only need one channel out of faust as modchain is a single channel node
                            T 1 Reply Last reply Reply Quote 0
                            • T
                              trummerschlunk @aaronventure
                              last edited by

                              @aaronventure ok, thanks...
                              For me it's not about gain reduction, so I hope the first option for 'metering something else' will work. I have a lot of meters though... 20 to be precise...

                              S 1 Reply Last reply Reply Quote 0
                              • S
                                sletz @trummerschlunk
                                last edited by

                                @trummerschlunk see my answer here: https://faustdoc.grame.fr/manual/syntax/#attach-primitive

                                T 1 Reply Last reply Reply Quote 0
                                • T
                                  trummerschlunk @sletz
                                  last edited by

                                  Thanks, @sletz, I am aware of the attach primitive. The problem is that no metering signals are available in HISE when the dsp network is compiled.

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

                                  21

                                  Online

                                  1.7k

                                  Users

                                  11.8k

                                  Topics

                                  102.6k

                                  Posts