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.
-
@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?
-
@observantsound You can use a global modulator for this I think
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