Filtering a parameter

Does anyone know how it’s possible to filter out the options for a parameter? What I want to do is use the clean filter but not have so many filter shape as options for the end user. Is there a way to write a script in order to filter-out/only use specific filter shapes?

Yes there is.

Load any Anima preset and inspect the script. It’s using only a subset of available filters. Then you can apply the same logic to filter shape or any other parameter that is using indexed string array.

I had a situation where this was needed.

Came up with this:

function onFilterList()
	if filterList > 5 then
		filterList = filterList + 8
	end
	zone:setParameter("Filter.ShapeA", filterList)
end
	
filters = {[0] = "LP24", "LP18", "LP12", "LP6", "BP12", "BP24", "BR12", "BR24"}
defineParameter("filterList", nil, 0, filters, onFilterList)

Awesome! You guys are a life saver!

This code is perfect for filtering. Do you know of a way to reorder the filters? I’m sorry if I’m asking too much. Coding isn’t my strong point.

Hi abject39.

Try this:

zone=this.parent:getZone()

filterShapes={
  {name="LP24",   index=0},
  {name="HP24",   index=10},
  {name="BP24",   index=5},
  {name="BR24",   index=15},
}

function getFilterShapeNames()
  filterShapeNames={}
  for i=1,#filterShapes do
    filterShapeNames[i]=filterShapes[i].name
  end
end

getFilterShapeNames()

function filterShapeChanged()
  zone:setParameter("Filter.ShapeA",filterShapes[FilterShape].index)
end

defineParameter("FilterShape",nil,1,filterShapeNames,filterShapeChanged)

The only thing you need to modify is the “filterShapes” array. Add more lines or reorder them.

You seriously are the best! Thank you so much! Is there a parameter index list hidden somewhere? Whenever I need to index something I’ve been screenshooting the list and counting the positions on the list. Is there a faster to way to get that? I feel like I’m probably doing it wrong lol.

There’s no hidden list that I know.
You can use parameter list or zone editor.

Modulation sources and destinations are listed here:
[u]https://developer.steinberg.help/display/HSD/Modulation+Source+Types[/u]

I find that very helpful if you want to limit modulation matrix options to those relevant to your instrument.


Edit:

You can print them if you want to.

element=this.parent:getZone()
parameter="Filter.ShapeA"
parameterDef=element:getParameterDefinition(parameter)

if parameterDef.type=="integer" then do
  for i=parameterDef.min, parameterDef.max do
    local displayString=parameterDef:getDisplayString(i)
    print("{name= \""..displayString.."\",          index= "..i.."},")
    end
  end
else
  print("Parameter is not integer")
end