HISE Logo Forum
    • Categories
    • Register
    • Login

    Controlling multiple modulators

    Scheduled Pinned Locked Moved Scripting
    4 Posts 2 Posters 1.0k 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.
    • d.healeyD
      d.healey
      last edited by

      The more I play with HISE the more I think you're a genius. Just started playing with the Modulator Connection Wizard, very helpful! I'm working on an instrument with 3 samplers, each has an ADSR, I've put a set of 4 knobs on the container's interface to control the ADSRs of each of the samplers. Currently I'm entering one line for each parameter of each sampler's envelope:

      if(number == sliA) normalPluckedADSR.setAttribute(normalPluckedADSR.Attack, value);
      ```but I wondered is there a better way to do this? is it possible to run a loop through all of the envelopes?
      
      Something like this pseudo code
      

      foreach sampler
      {
      foreach envelopes
      {
      sampler.envelope.attack = attack_knob
      sampler.envelope.decay = decay_knob
      sampler.envelope.sustain = sustain_knob
      sampler.envelope.release = release_knob
      }
      }

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

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

        I'd recommend using a switch statement (funnily I changed the module connector to use switch statements yesterday). I had to add switch support to Javascript myself (and I wrote the Module connector before that). Having a switch statement is faster and more readable.

        You could store all modulators in an array and then use a for loop to iterate over them.

        Check out this patch:

        HiseSnippet 1423.3oc6X01aaaCDlJNZaVstXcXaXejveoNnYN1NYsEMXq4kU2k0lWVUV2.JJZoknhIpDoFEURcKx22+j8uX+E1.1ej9OX6ndwRNUMINqcCnMBNFg2wGxm63w6NqcjBGZTjPhLtvtiBoHiKZZOhqFt9PBii13aQFW17178o9hP55BtRJ7QqMJjDEQcQFF0tidZF0mEk77xasFwmvcnEhPnGHXNz6wBXpBoOYk6x786Sbo6xBJM6kVYCGAecguHFnTMyNnPhySI6Q2hnm1Lln8YzChPFcLWrWa4S6N34q1Fdru51O+Gtw0osauy2A+c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pPktuSIcur4N5TRUy2Ypfu5yi2x7MqwqFl21yCRzUP1YM6+ym0trNaT4RoT4Bl1LNMo5VBQ9rjw3eRe2+NTtNc0Q5vZxVq+y27sVusiB18ckDdTnHZhE1lFv1Uv0NjBg+XDsuj9K2WeHWV95BhrRUu7V8AarRL1DUrLIZY0.QLWMQzQsyTe4SdoozQXEcAO6+CMo+l+l2+9DE0NcI2OgeGwGlyQaVPnOMuZeBGunYQaemL+RaOnbd2rJWkyidOHnhHAyl912zNN2+WXlRWr9hF9ci700d+Le88EwJFeuMIPmSOCYXtUbfMjmzgBLgyo9Q52YvL5bcoi6nGmlnj61I+EJjorqdrQlxt4JOE0D97ppIz67hBmWT3c2hB8Nunv4EEd+snv+E6Q.wQJdrS5ueUGK+QIR.6lm7V0qatodLzeV1OYU6aBfzaO1wQ6r+Rv6TMhdSMhEmZDKM0H9poFw0lZDWepQbiiAgtVxpwJQP5UOD5e.kD1C9.
        

        It contains of two sine generators with one envelope each and a switch statement in the control callback. The attack is controlled by directly calling each Modulator and the release is controlled using a loop statement. For your case I'd strongly recommend using the direct method.

        Also, did you check out the global modulator system? It doesn't work for envelope types (way too complicated to explain here), but voice start modulators and time variant modulators can be added once as global modulator and send their modulation value to its receivers which can be placed anywhere. Then you'll need to only control one modulator, which is incredibly useful for stuff like global velocity curves etc.

        http://hise.audio/blog/posts/the-global-modulator-system

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

          I was thinking an array would be the way to go. I didn't know switch statements had been implemented. I remember you wrote in the manual about these not being part of JUCE, I'm glad you've added them though, very useful.

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

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

            I noticed a little (possible) bug with the envelope. When I set the release time to 0ms via a control on the interface the actual release knob of the envelope only goes down to 1ms

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

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

            46

            Online

            1.7k

            Users

            11.7k

            Topics

            101.9k

            Posts