HISE Logo Forum
    • Categories
    • Register
    • Login

    Triggering of Different RR Groups, With Different Amounts of Samples, Without Triggering Dead Notes

    Scheduled Pinned Locked Moved Solved Scripting
    4 Posts 3 Posters 262 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.
    • A
      ATWAW
      last edited by ATWAW

      Hello, I am very new to HISE/scripting and had a question about triggering certain notes within a RR group. I am building a piano sampler instrument but some of my RR groups don't have samples for some notes, while other groups have samples for those same notes. I am trying to figure out a way to maintain my random RR while also eliminating any dead notes. As it currently stands, the code seems to cause the RR's to stop working and just remain on one RR group.

      onInit

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

      onNoteOn

      function onNoteOn()
      {
      	counter = (lastCount - 1 + Math.randInt(2, 5)) % 5 ;
      	NoteSamples.setActiveGroup(counter + 1);
      	lastCount = counter;
      
      	Message.getNoteNumber();
      	if (NoteSamples.isNoteNumberMapped(number));
      	Function.NoteSamples.setActiveGroup(1);
      }
      

      The code seems to compile okay, but when I play a note I get this error:

      Round Robin 1:! onNoteOn() - Line 8, column 37: API call with undefined parameter 0 {Um91bmQgUm9iaW4gMXxvbk5vdGVPbigpfDIwOHw4fDM3}

      I would still like to trigger the RR groups with less samples, but ONLY for the samples that they DO have, and not for the ones that they don't.

      Thank you in advance, I apologize if this is a silly question, I am still very new to scripting and HISE in general.

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

        @ATWAW

        ok lets start with this:

        function onNoteOn()
        {
        	counter = (lastCount - 1 + Math.randInt(2, 5)) % 5 ;
        	NoteSamples.setActiveGroup(counter + 1);
        	lastCount = counter;
        
        	Message.getNoteNumber();   <--and put it where?
        	if (NoteSamples.isNoteNumberMapped(number));  <-- whats "number" here?
        	Function.NoteSamples.setActiveGroup(1);
        }
        

        did you mean this?

        function onNoteOn()
        {
        	counter = (lastCount - 1 + Math.randInt(2, 5)) % 5 ;
        	NoteSamples.setActiveGroup(counter + 1);
        	lastCount = counter;
        
        	local Nnumber = Message.getNoteNumber();   
        	if (NoteSamples.isNoteNumberMapped(Nnumber));  
        	Function.NoteSamples.setActiveGroup(1);
        }
        

        HISE Development for hire.
        www.channelrobot.com

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

          Just duplicate the samples for the groups with missing notes.

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

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

            @d-healey Ahhhhh such a simple solution, thank you!

            1 Reply Last reply Reply Quote 1
            • A ATWAW has marked this topic as solved on
            • First post
              Last post

            27

            Online

            1.7k

            Users

            11.8k

            Topics

            102.8k

            Posts