Forum

    • Register
    • Login
    • Search
    • Categories

    Best way to assign LFO to two places in an FX plugin

    Scripting Forum
    4
    16
    174
    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.
    • T
      tomekslesicki last edited by

      Ok, maybe this is obvious, but I think I need some help here. I want to route an LFO to two places - one would get the normal LFO value, the other would get an inverted version of it.

      I'm routing the LFO from SimpleGain to two knobs: BlendBackend_A and BlendBackend_B.

      Currently I have it implemented with a timer like so:

      const var BlendBackend_A = Content.getComponent("BlendBackend_A");
      const var BlendBackend_B = Content.getComponent("BlendBackend_B");
      
      const var tremolotimer = Engine.createTimerObject();
      
          tremolotimer.setTimerCallback(function()
              {
                  var lfoval = LFORouterGainMod.getCurrentLevel();
                  var blendval = Blend.getValue();
      
                  BlendBackend_A.setValue(lfoval * (1 - blendval));
                  BlendBackend_B.setValue(lfoval * (1 - blendval));
              }
              
              BlendBackend_A.changed();
              BlendBackend_B.changed();
              
          });
      tremolotimer.startTimer(11);
      

      And it works but the values are getting glitchy sometimes and problems start with a non-realtime bounce.

      Is there a better way to approach this?

      Thank you!

      Lindon 1 Reply Last reply Reply Quote 0
      • d.healey
        d.healey last edited by

        Couldn't you use a global modulator for this instead of scripting it?

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        T 1 Reply Last reply Reply Quote 0
        • T
          tomekslesicki @d.healey last edited by

          @d-healey do they work on FX plugins?

          Christoph Hart 1 Reply Last reply Reply Quote 0
          • Lindon
            Lindon @tomekslesicki last edited by

            @tomekslesicki - use a Global Modulator:

            1. Create a Global Modulator Container in your top level container,
            2. Select Modulators and create an LFO
            3. Assign the modulator(and apply inverse) in each spot you want your modulator
            • So this all works fine for destinations that allow you to assign a modulator (like say Filter Frequency), but if you want to assign a modulator to an on-screen widget then you can use a Macro Modulation source and apply that to your widget...

            • the down side of this is that the widget then shows up with a little "flag" letting you know the macro modulator has been assigned, and doesnt then allow the end user to move the widget....

            If you want to hide this then you need to define two widgets for each control you want to manage this way:

            Widget 1 - the one visible in the interface - whos call back simply updates the value and issues changed() on the second widget

            Widget 2 - does the actual backend processing in its call back, and has a macro modulator assigned to it

            HISE Development for hire.
            www.channelrobot.com

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

              @Lindon thanks! The problem is that it's an FX plugin and last time I checked, Global Modulators were not exporting in this case? I may be wrong, it was a while ago.

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

                @tomekslesicki actually no, the global modulators (and macro modulation source container) will not be processed in an FX plugin, but that was requested multiple times and makes sense so I‘ll probably fix it soon.

                In the meantime you might try your luck with the (undeferred) onTimer callback, this should give you at least some real time predictability (the other timers run on the UI thread and have no guaranteed timing).

                T 1 Reply Last reply Reply Quote 2
                • T
                  tomekslesicki @Christoph Hart last edited by

                  @Christoph-Hart sounds promising! I can't find a way to implement it in the docs. Should be a pretty simple call I guess?

                  1 Reply Last reply Reply Quote 0
                  • T
                    tomekslesicki last edited by

                    @Lindon @d-healey I guess you’ve used this call before. Could you please tell me how to use it? It seems different than the standard timer...

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

                      @tomekslesicki said in Best way to assign LFO to two places in an FX plugin:

                      @Lindon @d-healey I guess you’ve used this call before. Could you please tell me how to use it? It seems different than the standard timer...

                      Go to HISE, open the APICollection panel, and type Timer into the search box....

                      HISE Development for hire.
                      www.channelrobot.com

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

                        @Lindon I got that part, just not sure how to assign the function to it 🙂

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

                          @tomekslesicki

                          Timer.setTimerCallback()

                          HISE Development for hire.
                          www.channelrobot.com

                          1 Reply Last reply Reply Quote 0
                          • d.healey
                            d.healey last edited by d.healey

                            Christoph is referring to the synth timer callback, not to timer objects. It's just a callback like the note on/off callbacks. Select it from the drop down menu and put your code in there. Start/stop it with Synth.startTimer() and Synth.stopTimer() - do this in a non-deferred script.

                            Libre Wave - Freedom respecting instruments and effects
                            My Patreon - HISE tutorials
                            YouTube Channel - Public HISE tutorials

                            T 1 Reply Last reply Reply Quote 0
                            • T
                              tomekslesicki @d.healey last edited by

                              @d-healey what is a non-deffered script? Sorry for so many questions, it’s just new to me.

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

                                https://docs.hise.audio/hise-modules/midi-processors/list/scriptprocessor.html#audio-thread-and-deferred-callbacks

                                1 Reply Last reply Reply Quote 0
                                • T
                                  tomekslesicki last edited by

                                  This post is deleted!
                                  1 Reply Last reply Reply Quote 0
                                  • T
                                    tomekslesicki last edited by

                                    Thank you!

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

                                    17
                                    Online

                                    1.1k
                                    Users

                                    6.8k
                                    Topics

                                    62.5k
                                    Posts