Hello,
the following script works for randomizing zones (and other parameters)
how can I adapt it in order to randomize the Layers instead of the zone?
-- Randomise Parameters Sample
local layer = this.parent
local zones = layer:findZones()
midiModule2 = this.parent:getMidiModule("Zone Select Sample")
reverb = this.parent:getBus():getEffect("Reverb")
VSTAmp = this.parent:getBus():getEffect("VST Amp")
StepFlanger = this.parent:getBus():getEffect("Step Flanger")
BitCrusher = this.parent:getBus():getEffect("H3 Bit Reduction")
Delay = this.parent:getBus():getEffect("Multi Delay")
rndTable = {
-- table 1 elements, table 2 parameters
{zones, {"Filter.Cutoff", "Filter.Resonance" , "Filter.ShapeA" , "LFO 1.WaveForm" , "LFO 1.RateSync" , "LFO 1.Shape" , "LFO 2.WaveForm" , "LFO 2.RateSync" , "LFO 2.Shape" , "SampleOsc.StretchFactor" , "SampleOsc.FormantShift" , "SampleOsc.FormantShiftKeytrack" , "SampleOsc.PSOLATransientSize"}},
{{layer}, {"Pan" , "Octave"}},
{{midiModule2}, {"activeZone"}},
{{reverb}, {"Mix" , "TailMainTime" , "ERSelect"}},
{{VSTAmp}, {"drive" , "bass" , "mid" , "treble" , "presence"}},
{{StepFlanger}, {"Rate" , "Depth" , "Phase" , "FB"}},
{{BitCrusher}, {"param2" , "param3" , "param4" , "param5", "Mix"}},
{{Delay}, {"syncnote1" , "feedbackoverall" , "delayLR" , "delaymode", "Mix"}},
}
function randomiseParameters()
if Rnd then
for i = 1, #rndTable do
local elements = rndTable[i][1]
local parameters = rndTable[i][2]
for j, parameter in ipairs(parameters) do
local rnd = math.random()
for k, element in ipairs(elements) do
element:setParameterNormalized(parameter, rnd)
end
end
end
wait(50)
Rnd = false
end
end
defineParameter{name = "Rnd", default = false, onChanged = randomiseParameters, persistent = false}
My instrument has 4 Layers
So basically what I’m trying to do is to have a button that when clicked randomizes the sub-layers (A1 A2 B1 B2 etc etc) inside Layer 1, Layer 2, etc etc.
Thanks in advance for any help!

