Shortlisting LFO Destinations via Lua Script

I have created a drop down menu on the macro page to enable the user to select LFO destination. Given elements such as wavetable, oscillators, etc are not part of my instrument I would like to remove these from the available options.

To do this I have created the following script.

local zone = this.parent:getZone()

local Destination = {
{name = “-”, index = 0},
{name = “Pitch”, index = 1},
{name = “Cutoff”, index = 2},
{name = “Resonance”, index = 3},
{name = “Distortion”, index = 4},
{name = “Pan”, index = 12},
{name = “Formant Shift”, index = 15},

}

function getDestinationNames()
DestinationNames = {}
for i = 1, #Destination do
DestinationNames[i] = Destination[i].name
end
end

getDestinationNames()

function DestinationChanged()
zone:setParameter(“LFO 1.Destination”, Destination[Destination].index)
end

defineParameter(“Destination”, nil, 4, DestinationNames, DestinationChanged)

As you can see by the screenshot the first half of the script works in that it displays the shortlisted items.

image

However, any selection made in this list isn’t reflected on the LFO itself. I assume this is due to an incorrect naming of the LFO1 parameter (I have used “Destination”).

Is my naming incorrect or have I made an error elsewhere?

You need to assign the lfo via modulation matrix. Then you can use your parameter to change the modulation destination.

local zone = this.parent:getZone()

local Destination = {
    {name = "-", index = 0},
    {name = "Pitch", index = 1},
    {name = "Cutoff", index = 2},
    {name = "Resonance", index = 3},
    {name = "Distortion", index = 4},
    {name = "Pan", index = 12},
    {name = "Formant Shift", index = 15},

}

function getDestinationNames()
    DestinationNames = {}
    for i = 1, #Destination do
        DestinationNames[i] = Destination[i].name
    end
end

getDestinationNames()

function DestinationChanged()
    zone:getModulationMatrixRow(1):setParameter("Destination.Destination", Destination[ModDestination].index)
end

defineParameter("ModDestination", nil, 4, DestinationNames, DestinationChanged)
1 Like

Amazing. It’s working!

image

image

thanks my issue has been fixed.

[quote=“jackyjoy123, post:4, topic:690494, full:true”]

my issue has been fixed.