One shared Script Voice Start Modulator for many Samplers?
-
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? -
@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.