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 858 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.
    • gorangroovesG
      gorangrooves @Christoph Hart
      last edited by

      @Christoph-Hart Please tell me more.

      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

        HiseSnippet 1711.3oc6as0SabDEdWfMM1IMpoJppONB0GLJDpM2ZknUXvXRsR.rvNWjPDz30ismxtyrc1wjXUk+K889SHOz7XqTdnOzeBsum+AsmYmcwqAiw3BI.ZsPHOWNm46bYNem0VtrfaS784BCyTU63QLLusUkNLYqBsvTlQo0LLui0FXeIQfzSsZGOruOotgo43OTMgYpILBd89kWE6fY1jtSYX7TN0l7XpKU1c1x4eD0wYcbcRUparcOe9R1bVAtCuMfmwsxZ3gs2G2jrIVsswrLLuQw5TIWTQhkDeXOqxq2oRK9KY58+TpOslCQMHmQEPQ5oMJzh5Tubjs5aXX9Ik6Z4iqs76YsAsN8v465A9rfEPckHtOvbrAAobmAHYFCRSngzcspXKndxtqnvysrJwf.RCL3piCE8dMF6ulvp.G1ASNiKdex5BXvgRjYwrYmFA+apkRm9q+ZjcKLqIAIaQ8QM3BD4.hnCxSv+QhsLMDO7knCvBT4RUK7C6UZy0J97hUPeOZmIwSNMZxZp+YO4tKgN1dqtx1OrX03hrStcmFsyrSilaZz7p2t.fjc2UCjpJD7RHw.0h6TGgQNTPc7FHLL09LdM+XmfGUZ25QpIU58jzvrq8.rPf6DoEIVzjH8QY74fAikv+HHJqN4UpcnFnNGjMlgpQPvow.e.oNRxQtscjTOGRjNl5nfoZnt6BmsXfNfisFjDqTgnsR7VDWEV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4FHv9k27lec4UodbGrPQMctgwKSLOayaKorlafgKPp1W1rsaEnfuMAPB7.vN9pVZFSUzVONqZrthOqdvf+EdEtXN0XyvEyEsXby8lmvGyzsC9LKfQjARp89yeRsiRdbI7CU5JFGQR2jWM6lb1jtIS5l75d2jylzMYR2jWLcSN6fAl8e7O+VR2jmqcSdVX2lKgc6zY2xkvtcklcatD1sD1sQKO6zX2lKgc6RL617IraIraW2Y2lOgcKgc6hgca9D1sODraW991Fl8p521vMR3gR91FtB+sMrPRGqIcrdcui0ER5XMoi0KlNVW3zAVRGqez97XVLgcKgc65N61hIraIraWLraKlvtcc4yi4CwY3hsE78r0+DoT4Z2LXFv2xB9wCmxZC0XTtneYTVVYmIqgKvFrmssJj9.HFzeYlcDjYtQPl4GAYVXDjYwQPluYDj4aGnLJh3UZK4t5xPvDkKF7KTyzrHCC2VBtYY7e5yrqA.
        
        // change this for every project
        const var PITCH_INDEXES = ["a", "b", "c"]; 
        const var PITCH_TARGET_INDEXES = [[1], [2, 3, 4], [5, 6]];
        
        // This will hold a list of all knobs
        const var pitchKnobs = [];
        
        // This will hold a 2D-array of all targets (so that the index of the knob can be connected to multiple targets)
        const var pitchTargets = [];
        
        // One callback to rule them all
        inline function onPitchKnob(component, value)
        {
        	// get the index from the list
        	local idx = pitchKnobs.indexOf(component);
        	
        	// set all targets in the target list for the given index
        	for(t in pitchTargets[idx])
        		t.setIntensity(value);
        }
        
        // This function will create the two arrays used in the callback
        inline function init()
        {
        	for(i = 0; i < PITCH_INDEXES.length; i++)
        	{
        		pitchKnobs.push(Content.getComponent("Pitch_" + PITCH_INDEXES[i]));
        		pitchKnobs[i].setControlCallback(onPitchKnob);
        		
        		local targets = [];
        		
        		for(p in PITCH_TARGET_INDEXES[i])
        			targets.push(Synth.getModulator("Constant" + p));
        		
        		pitchTargets.push(targets);
        	}
        }
        
        init();
        
        ulrikU 1 Reply Last reply Reply Quote 1
        • 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

                              34

                              Online

                              1.7k

                              Users

                              11.7k

                              Topics

                              101.9k

                              Posts