Changing samples in the zone

Paste this script in the UI script section.

Change “Zone 1” to your zone name and connect ‘SampleOsc.Filename’ zone parameter to the UI LoadFile parameter created by the script.
Now every time the filename changes it trigger the UI parameter and it retrieves the relevant information.

function onLoadFile()
	local zone = getElement():findZones(true, 'Zone 1')[1]
	local file = AudioFile.open(LoadFile)
	local length = file.length

	zone:setParameter('SampleOsc.SampleEnd', length)
end

defineParameter('LoadFile', nil, "" , onLoadFile)