Forum
    • Categories
    • Register
    • Login

    One shared Script Voice Start Modulator for many Samplers?

    Scheduled Pinned Locked Moved Scripting
    2 Posts 2 Posters 14 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

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

        26

        Online

        2.4k

        Users

        13.8k

        Topics

        119.8k

        Posts