Display currently played sample (file)name on a Macro-Page

Hello, I would like to display the filename of the currently played sample file on the macro page. I am not a coder - is there an easy way to do this?
Thank you!

1 Like

Depends how you mapped your samples. You could try something like this loop through all zones and check their mapping. It will get first zone that matches the note and velocity.

This will fail if you use round robins or alternate layers as it picks the first zone it finds and not necessarily the one being played in this case.

defineParameter{name = "ZoneName", default = "", persistent = false}
defineParameter{name = "Filename", default = "", persistent = false}

zones = this.parent:findZones(true)

function onNote(e)
	for i, zone in ipairs(zones) do
		if zone.keyLow <= e.note and zone.keyHigh >= e.note then
			if zone.velLow <= e.velocity and zone.velHigh >= e.velocity then
				ZoneName = zone.name
				Filename = zone:getParameter("SampleOsc.Filename")
				break
			end
		end
	end
	postEvent(e)
end