HISE Logo Forum
    • Categories
    • Register
    • Login

    Many knobs to control even more pitch modulators in a scalable fashion. How?

    Scheduled Pinned Locked Moved General Questions
    21 Posts 5 Posters 984 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.
    • ulrikU
      ulrik @Christoph Hart
      last edited by

      @Christoph-Hart I guess the difference is that in your example, all references are already made pre callback, and it will be faster? Is there a big difference in runtime?

      Hise Develop branch
      MacOs 15.3.1, Xcode 16.2
      http://musikboden.se

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

        @ulrik yes when you automate a control in the daw it will be called in the audio thread so going through the module tree and comparing strings to add to a array is absolutely out of the question.

        If itโ€˜s not automated it still might clog the scripting thread more than necessary.

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

          I usually try to create all references on init or when you load a preset or other singular events.

          ulrikU gorangroovesG 2 Replies Last reply Reply Quote 1
          • ulrikU
            ulrik @Christoph Hart
            last edited by

            @Christoph-Hart good to know! ๐Ÿ‘

            Hise Develop branch
            MacOs 15.3.1, Xcode 16.2
            http://musikboden.se

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

              @Christoph-Hart Thanks, Christoph.

              I do get why it is a much better idea to connect everything at initializing rather than doing it on the fly. However, I haven't come across any issue with the simpler script, as the intention is not to automate and change pitches while playing, but rather "set and forget."

              I'll look into this more closely and run some tests.

              My primary concern is "change this for every project."

              Why did you write this line like this?

              const var PITCH_TARGET_INDEXES = [[1], [2, 3, 4], [5, 6]];
              

              And not like this?

              const var PITCH_TARGET_INDEXES = [1, 2, 3, 4, 5, 6];
              

              Goran Rista
              https://gorangrooves.com

              Handy Drums and Handy Grooves
              https://library.gorangrooves.com

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

                @gorangrooves this way you can define how many targets you want to control with each slider.

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

                  For reference, here is the scalable working script that doesn't mess up with Pro Tools' onNoteOn and timers.

                  It creates arrays onInit by pulling all components and synth modulators with matching names. Then, in the callback, it iterates through the arrays to match portions of names. It works like a charm.

                  const var PitchModules = Synth.getAllModulators("PitchModule");
                  const AllPitchTuneKnobs = Content.getAllComponents("PitchTuneKnob");
                  
                  inline function onPitchKnobCallback(component, value)
                  {
                      local id = component.get("id");
                      local fxid = "PitchModule" + id.substring(id.length - 2, id.length);
                      
                      for (m in PitchModules)
                      {
                          // Check if the modulator's ID starts with the fxid
                          if (m.getId().contains(fxid))
                              m.setIntensity(value);
                      }
                  }
                  
                  for (k in AllPitchTuneKnobs)
                      k.setControlCallback(onPitchKnobCallback);
                  

                  Goran Rista
                  https://gorangrooves.com

                  Handy Drums and Handy Grooves
                  https://library.gorangrooves.com

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

                    @gorangrooves

                    are you saying this doesnt work inProTools?

                    const var PitchModules = Synth.getAllModulators("PitchModule");
                    const AllPitchTuneKnobs = Content.getAllComponents("PitchTuneKnob");
                    
                    inline function onPitchKnobCallback(component, value)
                    {
                        local pos = AllPitchTuneKnobs.indexOf(component);
                        PitchModules[pos].setIntensity(value);
                    }
                    
                    for (k in AllPitchTuneKnobs)
                        k.setControlCallback(onPitchKnobCallback);
                    

                    HISE Development for hire.
                    www.channelrobot.com

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

                      @Lindon This line was causing an issue in PT, when included within a knob callback:

                      local mods = Synth.getAllModulators(fxid);
                      

                      Your code is fine, although it wouldn't work in my use case, as I have a single knob like PitchTuneKnob01 controlling several modulators like PitchModulator01a, PitchModulator01b, etc.

                      The line with the issue doesn't allow onNoteOn callback and timers to run until the GUI is closed and re-opened.

                      Goran Rista
                      https://gorangrooves.com

                      Handy Drums and Handy Grooves
                      https://library.gorangrooves.com

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

                        @gorangrooves said in Many knobs to control even more pitch modulators in a scalable fashion. How?:

                        local mods = Synth.getAllModulators(fxid);

                        You should get all module references in on init rather than doing it dynamically like this.

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

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

                          @d-healey Yes, I did. See the post above.

                          Goran Rista
                          https://gorangrooves.com

                          Handy Drums and Handy Grooves
                          https://library.gorangrooves.com

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

                          12

                          Online

                          1.8k

                          Users

                          12.0k

                          Topics

                          104.5k

                          Posts