HISE Logo Forum
    • Categories
    • Register
    • Login

    Chokegroups for oneshots

    Scheduled Pinned Locked Moved General Questions
    4 Posts 2 Posters 173 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.
    • elemen8tE
      elemen8t
      last edited by

      Hey there,

      how do I create a script for choking oneshots from my sampler?

      (The usual approaches that I saw on the forum where noteOff commands which won't work once the oneshot got played)

      Also I am using one sampler engine so I would work with keytriggers that cancel each other or sth. if Note 70 is played then cut 66

      
      // Use const var for constants for improved performance.
      const var closeHiHatKey = 48;
      const var openHiHatKey = 58;
      
      //  An Array is also a constant, even if it will be populated later on
      const var evtList = [];
      
      // make sure it has enough storage to avoid allocation during the noteOn callback
      evtList.reserve(64);
      
      function onNoteOn()
      {
          if(Message.getNoteNumber() == closeHiHatKey)
          {
              // Always use the for ... in loop if you don't need the index
              for(eventId in evtList)
              {
                  // Send the note off command for the given event id
                  Synth.noteOffByEventId(eventId);
              }
              
              // Clear all notes
              evtList.clear();
          }
          else if (Message.getNoteNumber() == openHiHatKey)
          {
              // This is necessary because you will kill the note artificially and HISE
              // can only kill artifical notes for stability reasons
              Message.makeArtificial();
              
              // Add this ID to the list (it'll add the artificial event ID)
              evtList.push(Message.getEventId());
          }
      }
      function onNoteOff()
      {
          if(Message.getNoteNumber() == openHiHatKey)
          {
              // We need to ignore the note-off message
              // for the open hi-hat so it will keep ringing...
              Message.ignoreEvent(true);
          }
      }
      function onController()
      {
          
      }
      function onTimer()
      {
          
      }
      function onControl(number, value)
      {
          
      }
      
      1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey
        last edited by

        There is a built in choke group script, not sure if that will help in this situation but give it a try if you haven't already.

        d03fd72b-1910-4ee4-b108-5e5dfd8a5edf-image.png

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

        elemen8tE 1 Reply Last reply Reply Quote 0
        • elemen8tE
          elemen8t @d.healey
          last edited by

          @d-healey Thanks for the tip. It works great for different sampler engines to choke each other out but not if you got all samples inside one sampler engine.

          So I guess I will have to split them in order to choke them.

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

            @elemen8t said in Chokegroups for oneshots:

            So I guess I will have to split them in order to choke them.

            Yeah I think that would be the best way.

            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

            24

            Online

            1.8k

            Users

            11.9k

            Topics

            104.0k

            Posts