HISE Logo Forum
    • Categories
    • Register
    • Login

    Faust Compressors

    Scheduled Pinned Locked Moved Faust Development
    8 Posts 2 Posters 625 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.
    • LindonL
      Lindon
      last edited by Lindon

      OK so I thought I'd like to try out the Faust compressor code, so I created my scriptnode, with a code.faust node and added a file like this:

      // Faust Source File: faustCompFile
      // Created with HISE on 2023-02-15
      import("stdfaust.lib");
      
      
      //strength: strength of the compression (0 = no compression, 1 means hard limiting, >1 means over-compression)
      strength = hslider("Strength", 0, 0, 1, 0.01);
      //thresh: dB level threshold above which compression kicks in
      thresh = hslider("Thresh", 0, -60, 0, 0.1);
      //att: attack time = time constant (sec) when level & compression going up
      att = hslider("Attack", 0, 0, 2, 0.01);
      //rel: release time = time constant (sec) coming out of compression
      rel = hslider("Release", 0, 0, 3, 0.01);
      //knee: a gradual increase in gain reduction around the threshold: below thresh-(knee/2) there is no gain reduction, above thresh+(knee/2) there is the same gain reduction as without a knee, and in between there is a gradual increase in gain reduction.
      knee = hslider("knee", 0, 0, 8, 0.1);
      //prePost: places the level detector either at the input or after the gain computer; this turns it from a linear return-to-zero detector into a log domain return-to-threshold detector
      //prePost = hslider("Mode", 0, 0, 1, 1);
      //link: the amount of linkage between the channels. 0 = each channel is independent, 1 = all channels have the same amount of gain reduction
      //link = hslider("Link", 0, 0, 1, 0.01);
      
      process = co.RMS_compression_gain_N_chan(strength,thresh,att,rel,knee,1,0,2);
      

      This compiles fine --- but it massively reduces the output to nearly zero, so I think I'm doing something wrong. I checked the faust library documentation but its a little scant for the compressor values - so its not much help - anyone have any ideas?

      HISE Development for hire.
      www.channelrobot.com

      Dan KorneffD 1 Reply Last reply Reply Quote 0
      • Dan KorneffD
        Dan Korneff @Lindon
        last edited by

        @Lindon I think you're missing the channel I/O blocks in process.

        si.bus(N) : RMS_compression_gain_N_chan_db(strength,thresh,att,rel,knee,prePost,link,N) : si.bus(N)
        

        I think this would work:

        process = _,_: co.RMS_compression_gain_N_chan(strength,thresh,att,rel,knee,1,0,2) :_,_;
        

        Dan Korneff - Producer / Mixer / Audio Nerd

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

          @Dan-Korneff Thanks Dan, but sadly no - still cutting the volume to zero - it seems to be adding in some inaudible frequencies as when I turn on the scriptnode fx the meters got all he way up....

          HISE Development for hire.
          www.channelrobot.com

          Dan KorneffD 1 Reply Last reply Reply Quote 0
          • Dan KorneffD
            Dan Korneff @Lindon
            last edited by

            @Lindon This example doesn't work in the online Faust IDE either
            https://faustide.grame.fr/

            Dan Korneff - Producer / Mixer / Audio Nerd

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

              @Dan-Korneff said in Faust Compressors:

              @Lindon This example doesn't work in the online Faust IDE either
              https://faustide.grame.fr/

              yeah so I just found myself...

              HISE Development for hire.
              www.channelrobot.com

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

                @Lindon ..and I cant find the source of the faust provided working demo either...

                HISE Development for hire.
                www.channelrobot.com

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

                  Okay for everyone who ends up here asking why the Faust compressors dont work.....

                  The compressors (both linear and dB) do NOT output an attenuated signal....they output the attenuation value. So you will need to take your input signal and multiply it with the results of these "compressors", for example:

                  // Faust Source File: compTest
                  // Created with HISE on 2023-02-15
                  import("stdfaust.lib");
                  
                  
                  //strength: strength of the compression (0 = no compression, 1 means hard limiting, >1 means over-compression)
                  strength = hslider("Strength", 0, 0, 1, 0.01);
                  //thresh: dB level threshold above which compression kicks in
                  thresh = hslider("Thresh", 0, -60, 0, 0.1);
                  //att: attack time = time constant (sec) when level & compression going up
                  att = hslider("Attack", 0, 0, 2, 0.01);
                  //rel: release time = time constant (sec) coming out of compression
                  rel = hslider("Release", 0, 0, 3, 0.01);
                  //knee: a gradual increase in gain reduction around the threshold: below thresh-(knee/2) there is no gain reduction, above thresh+(knee/2) there is the same gain reduction as without a knee, and in between there is a gradual increase in gain reduction.
                  knee = hslider("knee", 0, 0, 8, 0.1);
                  //prePost: places the level detector either at the input or after the gain computer; this turns it from a linear return-to-zero detector into a log domain return-to-threshold detector
                  //prePost = hslider("Mode", 0, 0, 1, 1);
                  //link: the amount of linkage between the channels. 0 = each channel is independent, 1 = all channels have the same amount of gain reduction
                  //link = hslider("Link", 0, 0, 1, 0.01);
                  
                  compress(left,right) = left,right : co.RMS_compression_gain_N_chan(strength,thresh,att,rel,knee,1,0,2) : *(left), *(right);
                  
                  process = compress;
                  

                  My thanks to the Faust Slack members for this insight....

                  HISE Development for hire.
                  www.channelrobot.com

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

                    @Lindon However - right now this code seems to crash HISE or fail the DLL build process...

                    HISE Development for hire.
                    www.channelrobot.com

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

                    59

                    Online

                    1.7k

                    Users

                    11.7k

                    Topics

                    102.3k

                    Posts