HISE Logo Forum
    • Categories
    • Register
    • Login

    Function onNote range [Level:Beginner]

    Scheduled Pinned Locked Moved Scripting
    2 Posts 2 Posters 189 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.
    • S
      Shinami-Sound
      last edited by

      [Level:Beginner]
      Hello!
      I'm trying figure out how to make a non-repetitive round robin for each drum. So, I decided just to split drums into separate Sampler modules.

      Then I made a script in each:
      "on init"

      const var SamplerOpen = Synth.getSampler("SamplerOpen");
      
      SamplerOpen.enableRoundRobin(false);
      
      reg counter = 0;
      reg lastCount = 0; 
      

      Next, to separate the round-robin counter for both each drums I though of cutting the note range for "onNote".
      So, for one of my drums in the "onNote" section I tried:

      function onNoteOn(60, 64)
      {
      	counter = (lastCount - 1 + Math.randInt(2, 5)) % 4;
      	SamplerOpen.setActiveGroup(counter + 1);
      	lastCount = counter;
      }
      

      and it gave me this error:
      "Line 1, column 19: Found Literal when expecting ')'.

      Does anyone know what's wrong here and what would be a better approach?

      d.healeyD 1 Reply Last reply Reply Quote 1
      • d.healeyD
        d.healey @Shinami-Sound
        last edited by

        @Shinami-Sound I think I just replied to you on YouTube, but I'll respond here too.

        function onNoteOn(60, 64)

        This is not valid. The on note on function definition can't be modified.

        You need to either add a separate note filter script before your round robin script or incorporate the filter into your RR script. I suggest using a separate script. If you don't want to write your own you can use this one but I encourage you to try doing it yourself first.

        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

        15

        Online

        1.7k

        Users

        11.8k

        Topics

        102.5k

        Posts