HISE Logo Forum
    • Categories
    • Register
    • Login

    Velocity to delay

    Scheduled Pinned Locked Moved General Questions
    4 Posts 2 Posters 577 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.
    • hisefiloH
      hisefilo
      last edited by hisefilo

      Hi guys. How can I link velocity to Delay? I want to decrease delay time (i.e. 1/8 to 1/32T) when velocity increases. Maybe there's another way to archive what I'm wanting to do (it's for a Melodica flute to have some ms. of air sound before note sounds, depending on velocity)

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

        The delay effect is not working on voice level. You need to delay the note on message with a script depending on the velocity, but make sure you delay the corresponding note off by the same amount or you‘ll get stuck notes when played fast.

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

          I've written a script module that does this:

          /** Velocity 2 Delay Script
          *   Christoph Hart
          *   Public Domain
          *
          *   This script delays incoming notes depending on the velocity.
          *   You can set the max delay time and a curve using the UI widgets.
          */
          
          Content.setHeight(200);
          Content.setWidth(800);
          
          const var Table1 = Content.getComponent("Table1");
          const var Delay = Content.getComponent("Delay");
          
          // Store the calculated delays for each note to delay the corresponding note off message.
          const var noteDelays = [];
          
          /** Small helper function that fills a given array with the same value. */
          inline function fillArray(array, size, value)
          {
              array.reserve(size);
          
              for(i = 0; i < size; i++)
                  array.push(value);
          };
          
          // Init the array with zeros. 
          // This is required on initialisation to avoid reallocation in the note callbacks
          fillArray(noteDelays, 128, 0);
          
          function onNoteOn()
          {
              // Calculate the table value
              local multiplier = Table1.getTableValue(Message.getVelocity());
              
              // Calculate the sample amount for max delay
              local maxDelay = Engine.getSamplesForMilliSeconds(Delay.getValue());
              
              local delayToUse = maxDelay * multiplier;
              
              // Store the delay in the array
              noteDelays[Message.getNoteNumber()] = delayToUse;
              
              // Delay the event
              Message.delayEvent(delayToUse);
          }
          function onNoteOff()
          {
              // Delay the note off message by the previously calculated delay
          	Message.delayEvent(noteDelays[Message.getNoteNumber()]);
          }
          function onController()
          {
          	
          }
          function onTimer()
          {
          	
          }
          function onControl(number, value)
          {
          	
          }
          

          Check out this snippet:

          HiseSnippet 1648.3oc4X7uaSbC1WaOFMrfFRLo8mVHlTRoqsoiswDCsTRZgpQnU8JkgPHj6cN4r3N6LaesDXSh2f8xrGj8HrGg8Fr8Y66xcojVZ6XaRaQHz4ue+S+84tsTDRUJgD4M+tiFRQdenevHtNtSLgwQa1E4cY+dDklJwNP2czPhRQiPddydOC.u4mCY+86e6cIIDdHsDDBsmfERe.KkoKgNr82wRR1fDQ2kkVg5a1dyPAuiHQjA1yr9qfFRBeAY.8gDCYy3i77WOhoEx.MQSUHu4tqHZTPr3Pti98XJ19ITygVn.PPNvaHRhLVr4aTmXVRz1E9sBABc6xnvrtnvU86whXigWFM9HKBbIGUiGdybRlWqyo44Uw7lyYdWwOHTxFpKw3rs8nIhPldzpcoIjQSXaNFPyz7B9KuvB3BJwqhszhc3qWaALFxzRlRKFFiuOQlCa6r8SXg3thTHT.fbP2MlovJKq3HibTXFOTjx3CvbADD.nCo7HyYAGqio3Cx07RNI7DQFNjvwJp1hNk7RmjvZn3.S3QXBNLSd.EmoLhwPzi1DeHKZ.UqLRY450pWqifqob8RfbtOkMHV2X0UVo4sm.wiYQ53F2xAudMnXSowGPj3cIPZoE9N3BhAQ2QjNTvgCMtlC80LbUxiKrcbrXwdMmdVdYb.TUPsldHIILKApOhJBX8ERLkDFaCXXsnv8MDKjRpBjYTQ.EK52GmB4bnsXopliAYWm.uC9oOyoXHQGjRRRvwzjgPKb+LdnlYSDDMtOzEpfn6.1ATNlHkfVOjoispVA8bffSxnKgMQXFOgwokRvv7ZFVZXYbQrh8J5hNNZVu1qqWCRtNgtD3CTHA1vPhKjXvA9cCFXrqbaLC+MV9gutwMZ5PWx9vLUbCmfucsepHjtIm4pXpX3uhJEpkvV71RS3eR5OjwjP3FLZFvCijvTDWTPfIGH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K.XG4.3N1PJXIbNMwbCl2LlMWbmWwb1cIKOxd3Ofe4HaYN6kirUAx+QzQJITJddnaoQSs7EsP.+la+yeMueOyY730RMwFXaG1yCCMA6OChNSmiUOyb74mYNt4Yliu3LywWdl43qNybbqSfCyrm0xzhTWqGB8mznL4NB
          
          hisefiloH 1 Reply Last reply Reply Quote 2
          • hisefiloH
            hisefilo @Christoph Hart
            last edited by

            @christoph-hart Awesome!!!! thanks once again! Will try it later today

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

            19

            Online

            1.7k

            Users

            11.8k

            Topics

            102.7k

            Posts