Forum
    • Categories
    • Register
    • Login

    One shared Script Voice Start Modulator for many Samplers?

    Scheduled Pinned Locked Moved Scripting
    4 Posts 3 Posters 46 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.
    • observantsoundO
      observantsound
      last edited by

      I'm working with 4 samplers currently, divided in a sustain section and a release section.
      For both I'm offering the option to offset or positively randomize the SampleStartPosition determined by 2 sliders.
      I'm doing this via a Script Voice Start Modulator on every sampler.

      Every one of these voice start scripts looks identical except for one line.

      on Init{
      include("DSP.js");
      
      // This is the only line that differs
      const var type = "body"; // OR const var type = "tail"
      }
      
      function onVoiceStart(voiceIndex)
      {
      	if (type == "body")
      	{
              // Globals set by slider callbacks
      		return DSP.getRandomOffsetAmount(Globals.BodyStartOffset, Globals.BodyStartRandom);	
      	}
      	else
      	{
      		return DSP.getRandomOffsetAmount(Globals.TailStartOffset, Globals.TailStartRandom);	
      	}
      	
      }
      
      inline function getRandomOffsetAmount(offset, randomAmount)
      {
          local r = Math.random() * randomAmount;            // unipolar: forward only
          // local r = (Math.random() - 0.5) * randomAmount; // bipolar option
          return Math.range(offset + r, 0.0, 1.0);
      }
      
      
      Right now it works and it's not a big deal having to copy paste the script 4 times, but I'd like to know how I can do something like this more efficiently in the future.
      I tried using the Builder to build my module tree and to attach external files to the script processors, but I think it's bugged.
      
      Any suggestions?
      HISEnbergH 1 Reply Last reply Reply Quote 0
      • HISEnbergH
        HISEnberg @observantsound
        last edited by

        @observantsound I think the HISE CLI will one day handle this: https://github.com/christophhart/hise-cli . So you can point an AI agent at HISE and have it build the module tree.

        Likewise, you can crack open the .xml and copy/paste whatever is happening with one sampler to all the others, but you will need to update the names and everything. You can also just let an AI do that (but it can become problematic if it becomes corrupted).

        I believe your intuition was correct though, using the builder is meant to solve this but it is buggy atm.

        It can become tedious work though, a copy/paste feature for the module tree would be a nice addition.

        Sonic Architect && Software Mercenary

        observantsoundO 1 Reply Last reply Reply Quote 0
        • observantsoundO
          observantsound @HISEnberg
          last edited by

          @HISEnberg If there's really no way around to having one ScriptStartVoiceModulator per sampler, then I'll deal with it. It's not that big of an issue.

          My question was more regarding workflow/signal flow.
          I'm still new to HISE so I'm unsure about what's possible and where the limits are.
          Like, would a global modulator (one in my Body and one in my Tail sampler container) work?
          All samplers in my Body container play at the same time (for color crossfading), so they can essentially be handled as one unit.

          But maybe SamplerVoiceStart is just a hardcoded factor and must be a child layer of a sampler?

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

            @observantsound You can use a global modulator for this I think

            https://youtu.be/Y2XhAEE1IBI

            Also you can use a single sampler for sustain and release - in most cases. I posted a video about this on Patreon recently: https://www.patreon.com/davidhealey/posts/how-to-create-156513314

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

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

            16

            Online

            2.4k

            Users

            13.8k

            Topics

            119.8k

            Posts