HISE Logo Forum
    • Categories
    • Register
    • Login

    Ignore notes outside of velocity range of currently loaded samples within a sampler

    Scheduled Pinned Locked Moved General Questions
    11 Posts 3 Posters 325 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
      last edited by

      Hey guys,
      Is there a way to get the velocity range in use for the samples currently loaded within a sampler?

      I am trying to ignore midi notes with velocities that do not have samples loaded inside a sampler.
      For example: Sampler has C1 samples for velocity range 30-127, but note C1 with velocity 10 gets played- ignore this note.

      Is it possible to accomplish this programmatically, or do I have to specify the range to be ignored?

      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 Yes you can check the properties of individual samples.

        First you need to get a selection of samples, you then iterate through it and check the properties you're interested in.

        5add3d39-f349-4f3e-960f-8d61debed065-image.png

        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 Thanks, Dave. I am a bit lost. I understand the basic concept but am having trouble actually implementing it.
          Any chance you could give me some practical examples, please?

          Goran Rista
          https://gorangrooves.com

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

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

            HiseSnippet 1318.3oc4XEtaaaCDlxNpq1qqcsn+X+Y.BA6GNCcF1sooCXnnN1wo0nwIFQYA8eELRz1DghTfhJqdC4kYOA6QXOR8MX6HkTrjspQhQW6FlgQrt69tiGOd7tSYjT3QhhDRjUsSlERPV2w1cFWMs2TLkiFrGx5KrUSo7IntyBwQQDejkU0WpEZUaCj4y6eQWLCy8HyYgPmJndjCnAT0bti57ZJ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LFlsyP2dA5Gu.8SVfd6Ene5Bz6r.8ylSmDPGhC0YF5YKWuhjfAFggsbNjcoStx3IbJV9HGzRFC7VeFlL8iSMnOikIKL7bsLezklLf1Ev0Ofi1Ge.zdYLNlox3VrTvPAWDNUvodES1gj2ISHx79doancUJ3t1bNOrywvXp3nb2V+tNG.iOikEuCeihE27WjnzyquwNwccz0ub9ua6sp+uo81pBQ2Ms4liY96+EdFdGaSIXGcGyOkt2whXEz8KqCjMzlxEZM6Qx2rphtAXBcKMs1IbgW5yP7WvmTgsy5roE1NSHxKyTv9I8Yy.uVUIIu+jdJLFzyjkOEMBF.P6RP2mOIdY.1SJdqWxKKn80aa3.dI27eXol8PMsSaj4EH.8ra0rEJ.5w7VOOcR9O.srJWmGuF57j0PmsWCcd5ZnyNqgNOaMz4GWoN5166FqDAIE8.Fi5mjXY0+pDqpn+FIILZsA
            

            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 Oh, man. Going to try it now! 😀 Thank you so much!

              Goran Rista
              https://gorangrooves.com

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

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

                @d-healey I've played around with it and what seems to be happening is that the attributes (hiVel and loVel) are only getting pulled from the lowest velocity samples in a sampler. So, if the very bottom sample is from 1-4, but the whole sampler uses the range from 1-100, it gets a value of 1 for loVel and a value of 4 for hiVel.

                What am I missing here?

                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 You need to fetch the min and max values over the loop, looks like your just using the last item in the loop.

                  local loVel = 127;
                  local hiVel = 0;
                  
                  for(s in selection)
                  {
                      loVel = Math.min(loVel, s.get(Sampler.LoVel);
                      hiVel = Math.max(hiVel, s.get(Sampler.HiVel);
                  }
                  
                  gorangroovesG 1 Reply Last reply Reply Quote 1
                  • gorangroovesG
                    gorangrooves @Christoph Hart
                    last edited by gorangrooves

                    @Christoph-Hart Thank you.
                    I am still not managing to make it work. The script you provided here is not executing. I get an error on the Math.min line:

                    Line 7, column 49: Found ';' when expecting ',' 
                    

                    If I make the change as suggested in the error message, I get a different error msg:

                    Line 8, column 5: Too many arguments in API call Math.min(). Expected: 2 
                    

                    That's the line with Math.max.

                    Here is the script that I am trying to execute inside a sampler's MIDI processor, combing what you gave me.

                    EDIT: This is the edited, fully functional script for anyone else who may need it. 🥰🎉🎈

                    onInit
                    var selection = Sampler.createSelection(".*");
                    var loVel = 127;
                    var hiVel = 0;
                    
                    for(s in selection)
                    {
                        loVel = Math.min(loVel, s.get(Sampler.LoVel));
                        hiVel = Math.max(hiVel, s.get(Sampler.HiVel));
                    }
                    
                    onNoteOn
                    function onNoteOn()
                    {
                    	local number = Message.getNoteNumber();
                    	local velocity = Message.getVelocity();
                    
                    	
                    	if (!Sampler.isNoteNumberMapped(number) || velocity<loVel)
                    	    Message.ignoreEvent(true);
                    	
                    	else if (!Sampler.isNoteNumberMapped(number) || velocity>hiVel)
                    	    Message.ignoreEvent(true);
                    }
                    
                    

                    BTW, the objective here is to not allow notes outside of the sampler to change round robin groups of the sampler. That way, each sampler operates its own round robin. It would be nice if there were a simple switch for this :)
                    I can make it work by specifying the velocity value range to ignore, but having a universal script that works in all samplers will be much easier.

                    Any help is much appreciated. Thank you.

                    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 I just forgot the ) at the end of those lines.

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

                        @Christoph-Hart 😁 Thank you. Time to put it to test.

                        Goran Rista
                        https://gorangrooves.com

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

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

                          @Christoph-Hart @d-healey Thank you so much for your help, guys. The script I posted (and edited) above is 100% functional and will make a wonderful improvement to my plugins, hence everyone else who uses them. 😊

                          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

                          51

                          Online

                          1.7k

                          Users

                          11.7k

                          Topics

                          102.1k

                          Posts