Hello, I found this script written by @misohoza , how I can modify it in order to work if the zones are inside Layers?
zones = this.parent:findZones()
function getZoneNames()
zoneNames = {}
for i, zone in ipairs(zones) do
zoneNames[i] = zone.name
end
end
getZoneNames()
defineParameter("ZoneSelect", nil, 1, zoneNames)
function onNote(event)
playNote(event.note, event.velocity, -1, zones[ZoneSelect])
end

this is the original instrument created by @misohoza
Amp Envelope.vstpreset (12.8 KB)
Thanks in advance for any help!
Hi @StringAudio
This script only deals with selecting zones that should receive the note on events. If you put them inside layers you can change the first line to zones = this.parent:findZones(true)
or target the layers themselves.
The scope for the envelope template is done in the ui script. You need to adjust that too.
Amp Envelope Layer.vstpreset (12.8 KB)
Thanks!
How can I have the menu switch ADSR control between layers instead of zones?

I’m using this script to change the layer how can I adapt it to have the ADSR control to control the selected zone layer?
layers = this.parent:findLayers()
function getLayerNames()
layerNames = {}
for i, layer in ipairs(layers) do
layerNames[i] = layer.name
end
end
getLayerNames()
defineParameter("LayerSelect", nil, 1, layerNames)
function onNote(event)
playNote(event.note, event.velocity, -1, layers[LayerSelect])
end
Only zones have envelopes. How do you want to use the layers with adsr? A screenshot of program tree would help.
this is my program tree.
so basically I have a menu that I use to switch from one layer to another one (Skin A, Skin B etc etc).
I would like that the “envelope editor” in the GUI is updated to control the ADSR of the layer selected in the menu with the Layer selector script.
Layer selectror script I’m using:
layers = this.parent:findLayers()
function getLayerNames()
layerNames = {}
for i, layer in ipairs(layers) do
layerNames[i] = layer.name
end
end
getLayerNames()
defineParameter("LayerSelect", nil, 1, layerNames)
function onNote(event)
playNote(event.note, event.velocity, -1, layers[LayerSelect])
end
Try if this works:
layers = this.parent:findLayers()
scopes = {}
function getLayerNames()
layerNames = {}
for i, layer in ipairs(layers) do
layerNames[i] = layer.name
scopes[i] = "@0:" .. this.parent.name .. "/@0:" .. layer.name .. "/@type:Zone/"
end
end
getLayerNames()
defineParameter("Scope", nil, 1, scopes)
defineParameter("LayerSelect", nil, 1, layerNames, function() Scope = LayerSelect end)
function onNote(event)
playNote(event.note, event.velocity, -1, layers[LayerSelect])
end
Amp Env.vstpreset (12.8 KB)
1 Like
I had to change my program tree, now the layers are inside an “All” layer.

With this script, the menu to show the sub-layers A1, A2, etc is working but I’m unable to connect the ADSR anymore, how can I modify the script?
layers = this.parent:findLayers()
scopes = {}
function getLayerNames()
layerNames = {}
for i, layer in ipairs(layers) do
layerNames[i] = layer.name
scopes[i] = "@0:" .. this.parent.name .. "/@0:" .. layer.name .. "/@type:Zone/"
end
end
getLayerNames()
defineParameter("Scope", nil, 1, scopes)
defineParameter("LayerSelectA", nil, 1, layerNames, function() Scope = LayerSelectA end)
function onNote(event)
playNote(event.note, event.velocity, -1, layers[LayerSelectA])
end
It looks like the problem is the scope :
instead of: @0:Layer 1/@0:Layer Selector A/@par:Scope
should be: @0:All/@0:Layer 1/@0:Layer Selector A/@par:Scope

Thanks in advance for any help!
Yes, it is most likely that.
Try to change the line to
scopes[i] = "@0:All/@0:" .. this.parent.name .. "/@0:" .. layer.name .. "/@type:Zone/"
1 Like