Filtering a parameter

Post topics about HALion scripting.
Post Reply
User avatar
abject39
Member
Posts: 319
Joined: Sat Jan 17, 2015 8:20 pm
Location: Ventura, Ca
Contact:

Filtering a parameter

Post by abject39 » Thu Aug 17, 2017 5:47 am

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?
My vision is uncompromising: to transcend my clients dreams by mesmerizing their audience with the world's finest audio arrangements and products.

misohoza
Member
Posts: 869
Joined: Sun Oct 05, 2014 12:18 am
Contact:

Re: Filtering a parameter

Post by misohoza » Thu Aug 17, 2017 3:02 pm

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.
Win 10 Home, 64 bit, 8 gb ram,
Cubase Pro 10.5, Wavelab Pro 9.5, Halion 6, Dorico 3,
NI Komplete 10 Ultimate, Ozone 7,
UR 44

AposMus
Member
Posts: 201
Joined: Fri Nov 14, 2014 11:41 am
Contact:

Re: Filtering a parameter

Post by AposMus » Fri Aug 18, 2017 3:44 pm

I had a situation where this was needed.

Came up with this:

Code: Select all

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)
Cubase Pro 8.5.2
Halion 6
HSO
Padshop Pro
Dark Planet

User avatar
abject39
Member
Posts: 319
Joined: Sat Jan 17, 2015 8:20 pm
Location: Ventura, Ca
Contact:

Re: Filtering a parameter

Post by abject39 » Mon Aug 21, 2017 5:19 am

Awesome! You guys are a life saver!
My vision is uncompromising: to transcend my clients dreams by mesmerizing their audience with the world's finest audio arrangements and products.

User avatar
abject39
Member
Posts: 319
Joined: Sat Jan 17, 2015 8:20 pm
Location: Ventura, Ca
Contact:

Re: Filtering a parameter

Post by abject39 » Tue Aug 22, 2017 4:50 am

AposMus wrote:
Fri Aug 18, 2017 3:44 pm
I had a situation where this was needed.

Came up with this:

Code: Select all

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)
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.
My vision is uncompromising: to transcend my clients dreams by mesmerizing their audience with the world's finest audio arrangements and products.

misohoza
Member
Posts: 869
Joined: Sun Oct 05, 2014 12:18 am
Contact:

Re: Filtering a parameter

Post by misohoza » Tue Aug 22, 2017 3:35 pm

Hi abject39.

Try this:

Code: Select all

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.
Win 10 Home, 64 bit, 8 gb ram,
Cubase Pro 10.5, Wavelab Pro 9.5, Halion 6, Dorico 3,
NI Komplete 10 Ultimate, Ozone 7,
UR 44

User avatar
abject39
Member
Posts: 319
Joined: Sat Jan 17, 2015 8:20 pm
Location: Ventura, Ca
Contact:

Re: Filtering a parameter

Post by abject39 » Wed Aug 23, 2017 3:41 am

misohoza wrote:
Tue Aug 22, 2017 3:35 pm
Hi abject39.

Try this:

Code: Select all

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.
My vision is uncompromising: to transcend my clients dreams by mesmerizing their audience with the world's finest audio arrangements and products.

misohoza
Member
Posts: 869
Joined: Sun Oct 05, 2014 12:18 am
Contact:

Re: Filtering a parameter

Post by misohoza » Wed Aug 23, 2017 2:14 pm

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

Modulation sources and destinations are listed here:
https://developer.steinberg.help/displa ... urce+Types

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.

Code: Select all

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
Win 10 Home, 64 bit, 8 gb ram,
Cubase Pro 10.5, Wavelab Pro 9.5, Halion 6, Dorico 3,
NI Komplete 10 Ultimate, Ozone 7,
UR 44

Post Reply

Return to “Halion Scripting”

Who is online

Users browsing this forum: No registered users and 1 guest