<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[One shared Script Voice Start Modulator for many Samplers?]]></title><description><![CDATA[<p dir="auto">I'm working with 4 samplers currently, divided in a sustain section and a release section.<br />
For both I'm offering the option to offset or positively randomize the SampleStartPosition determined by 2 sliders.<br />
I'm doing this via a Script Voice Start Modulator on every sampler.</p>
<p dir="auto">Every one of these voice start scripts looks identical except for one line.</p>
<pre><code>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?</code></pre>
]]></description><link>https://forum.hise.audio/topic/14834/one-shared-script-voice-start-modulator-for-many-samplers</link><generator>RSS for Node</generator><lastBuildDate>Thu, 11 Jun 2026 16:15:30 GMT</lastBuildDate><atom:link href="https://forum.hise.audio/topic/14834.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 11 Jun 2026 13:34:47 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to One shared Script Voice Start Modulator for many Samplers? on Thu, 11 Jun 2026 14:37:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.hise.audio/uid/2118">@observantsound</a> I think the HISE CLI will one day handle this: <a href="https://github.com/christophhart/hise-cli" rel="nofollow ugc">https://github.com/christophhart/hise-cli</a> . So you can point an AI agent at HISE and have it build the module tree.</p>
<p dir="auto">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).</p>
<p dir="auto">I believe your intuition was correct though, using the builder is meant to solve this but it is buggy atm.</p>
<p dir="auto">It can become tedious work though, a copy/paste feature for the module tree would be a nice addition.</p>
]]></description><link>https://forum.hise.audio/post/121117</link><guid isPermaLink="true">https://forum.hise.audio/post/121117</guid><dc:creator><![CDATA[HISEnberg]]></dc:creator><pubDate>Thu, 11 Jun 2026 14:37:43 GMT</pubDate></item></channel></rss>