My instrument is to have an attack slider to control the start point of particular samples. I’ve written a script, which works just fine changing SampleOsc.SampleStart of every zone. However I have so many samples to have altered attack that the constantly firing loop causes freezing of UI and a delay in action. Below is the script block used, when the attack slider is moved:
for i, zone in ipairs(zones_sus_tonal) do
And zones_sus_tonal is created only once and beforehand like this:
zones_sus_tonal = layers:findZones(true)
Also zones_sus_tonal is not the only set, - there are several others, which I’ve omitted for simplicity.
Would appreciate an advice on how to fix the script or to implement a totally different idea to change sample start point
You may try to use SampleStartRange as modulation destination and your slider as modulation source.
defineParameter("SampleStart", nil, 0, 0, 100)
return SampleStart / 100
local zones = this.parent:findZones(true)
for i, zone in ipairs(zones) do
local modRow = zone:getModulationMatrixRow(1)
modRow:setSource1(ModulationSource.modulationModule, this, 1)
Are you trying to change the sample start during playback? Halion might not handle this very well.
Thank you for the suggestion! As a newbie I got the idea and believe I successfully incorporated the piece of code above to my script. However I don’t know how to check it visually whether the start of the sample is changing. Must the blue bar below move along with my slider at UI?
So far I see in Parameter List that UI slider changes related script parameter. But I’m not sure if the script parameter in its turn as a mod sources changes mod destination.
The modulation destination “Sample Start” is a bit misleading. It doesn’t change the the sample start parameter itself.
You can check that in sample editor. You should see the playback starts from different point within the sample start range.
No, it should stay like this.
Thank for the explanation. Yes, visually it’s not that obvious. I had to set a relatively large Start Range for each sample and only after that I saw that the UI slider indeed controlled the sample start.