Forum
    • Categories
    • Register
    • Login

    Modulating Loop Start/End in real-time (a-la Sample Start)

    Scheduled Pinned Locked Moved Scripting
    6 Posts 3 Posters 57 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.
    • G
      Giuseppe
      last edited by Giuseppe

      Hello everyone,
      following a conversation with @Lindon on VI-Control, I'll post here a problem in which I stumbled.
      I have a waveform displaying the current sample, and I'd like to have loop start/end handles that I can freely drag in real time WITHOUT having the sample killed once I release the mouse. In other words, same behaviour as using a slider to control the Sample Start modulator.
      I know there are no inbuilt modulators for Loop Start/End, so the best I came up with is this

      var sampler = Sampler1.asSampler();
      var allSamples = sampler.createSelection(".*");
      
      
      WaveformOverlay.setMouseCallback(function(event)
      {
      var s = allSamples[0];
      var sampleLength = s.get(Sampler.SampleEnd);
      s.set(Sampler.SampleStart, 0);
      if (this.data.dragging == "ls")
      	       {
      		       this.data.loopStart = Math.max(this.data.offset, Math.min(normalizedX, this.data.loopEnd));
      		       
      		       s.set(Sampler.LoopStart, parseInt(this.data.loopStart*sampleLength));
      		       Console.print("New loop start: " + parseInt(this.data.loopStart*sampleLength));
      	       }
      	       if (this.data.dragging == "le")
      	       {
      	          this.data.loopEnd = Math.max(this.data.loopStart, normalizedX);
      	          s.set(Sampler.LoopEnd, parseInt(this.data.loopEnd*sampleLength));
      	          Console.print("New loop end: " + parseInt(this.data.loopEnd*sampleLength));
      	       }
      }
      

      I see the loop start/end values being correctly set in the Sample Editor, but again, once I drop the controls on the UI the sample, as expected, is killed.

      Any workaround besides touching the source code?

      David HealeyD 1 Reply Last reply Reply Quote 0
      • David HealeyD
        David Healey @Giuseppe
        last edited by

        @Giuseppe If you load the entire sample into ram does it still mute the audio engine when adjusting the loop points?

        Free HISE Bootcamp Full Course for beginners.
        YouTube Channel - Public HISE tutorials
        My Patreon - HISE tutorials

        G 1 Reply Last reply Reply Quote 0
        • G
          Giuseppe @David Healey
          last edited by

          @David-Healey I set SampleStartMod and LoopEnd to the entire sample length in Sample Editor. Does this equal to loading the sample entirely in the RAM? In this case, yes, it still drops the audio when the loop controls are released.

          David HealeyD LindonL 2 Replies Last reply Reply Quote 0
          • David HealeyD
            David Healey @Giuseppe
            last edited by

            @Giuseppe Yes that should load the entire sample into RAM. You can also set the sampler's preload size to -1.

            Free HISE Bootcamp Full Course for beginners.
            YouTube Channel - Public HISE tutorials
            My Patreon - HISE tutorials

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

              @Giuseppe Okay so the alternate approach is to use a hybrid of granular sampling....

              As you know its possible to move the start point of any played sample, and you know the loop start point and the loop end point........

              So start a note at the loop start point and make it play until the loop end point, then start another note from the loop start point and repeat.....

              At this point it is possible for you to change the start and end point of the "loop" to anything you want, at any point in the process....and theres no killing of the currently playing note....

              In fact you dont even need to use the loop start point and end point - these can be any position you choose....using the interface with some LAF for the sliders...

              HISE Development for hire.
              www.channelrobot.com

              G 1 Reply Last reply Reply Quote 0
              • G
                Giuseppe @Lindon
                last edited by

                @Lindon
                Thanks Lindon, I'll try this (I guess I need to operate in onNoteOn).
                @David-Healey Ok, tried also to set PreLoad size to -1 but the voice killing still happens.

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

                15

                Online

                2.2k

                Users

                13.3k

                Topics

                115.7k

                Posts