Edit Envelope Curve Value

I would like to modify the curve value of a filter envelope node of a synth Zone in Halion 6. The ultimate goal is to be able to assign the envelope value to a midi controller. It is straightforward to add an envelope editor or curve editor to my macro page, which allows me to modify the envelope node points and its various values by mouse on the macro page itself. But that does not allow me to modify the value of a curve (or other values of a given node) by a quick control or by a midi cc.

So I tried to assign the curve value to a slider on my macro page which I could then in turn easily assign to a midi controller. I tried it via the envelope editor on the macro page and by guessing how to access the original filter Parameters directly (similar to DCAAttOffset for example). The problem is, that I could not figure out how to address the curve value of a node. Obviously, I can have multiple nodes, so I would have to write something like @index:0/@curve as the value of my slider. But the information on Curve Editor - HALion Macro Page - Steinberg Developer Help is not enough for me to get it to work.

Once again, I obviously need to address a value in an array of variables, where the array contains essentially the nodes of an envelope. (The solution should not only work for the curve value but also for the level and time value of a node.)

Any help would be greatly appreciated. A working example would be perfect.

Hi KlingKlong,

So I tried to assign the curve value to a slider on my macro page which I could then in turn easily assign to a midi controller. I tried it via the envelope editor on the macro page and by guessing how to access the original filter Parameters directly (similar to DCAAttOffset for example). The problem is, that I could not figure out how to address the curve value of a node.

You can’t do it directly because Halion handles all envelope nodes and their curve, level and time values from a single parameter called EnvelopePoints. It is possible to change those via scripting. So you could create a script parameter that would control curve of a specific envelope node and attach that to a macro page slider. You can find some info about envelope points array here: https://developer.steinberg.help/display/HSD/insertEnvelopePoint

So you could try something like this to control some parameters of filter envelope (assuming you have a program with a single synth zone):

zone = this.parent:getZone()
filterEnvPoints = zone:getParameter("Filter Env.EnvelopePoints")
filterSustainIndex = zone:getParameter("Filter Env.SustainIndex")


function setFilterEnvelopePoints()
  filterEnvPoints[2].duration = FilterAttack/1000
  filterEnvPoints[2].curve = FilterAttackCurve/10
  filterEnvPoints[filterSustainIndex].duration = FilterDecay/1000
  filterEnvPoints[filterSustainIndex].curve = FilterDecayCurve/10
  filterEnvPoints[filterSustainIndex].level = FilterSustain/100
  filterEnvPoints[#filterEnvPoints].duration = FilterRelease/1000
  filterEnvPoints[#filterEnvPoints].curve = FilterReleaseCurve/10
  zone:setParameter("Filter Env.EnvelopePoints", filterEnvPoints)
end

defineParameter("FilterAttack", nil, 0,0,30000,1, setFilterEnvelopePoints)
defineParameter("FilterAttackCurve", nil, 0,-10,10, setFilterEnvelopePoints)
defineParameter("FilterDecay", nil, 250,0,30000,1, setFilterEnvelopePoints)
defineParameter("FilterDecayCurve", nil, -10,-10,10, setFilterEnvelopePoints)
defineParameter("FilterSustain", nil, 100,0,100,1, setFilterEnvelopePoints)
defineParameter("FilterRelease", nil, 200,0,30000,1, setFilterEnvelopePoints)
defineParameter("FilterReleaseCurve", nil, -10,-10,10, setFilterEnvelopePoints)

--get initial values
function getFilterEnvPoints()
  filterEnvPoints = zone:getParameter("Filter Env.EnvelopePoints")
  FilterAttack = filterEnvPoints[2].duration*1000
  FilterAttackCurve = filterEnvPoints[2].curve*10
  FilterDecay = filterEnvPoints[filterSustainIndex].duration*1000
  FilterDecayCurve = filterEnvPoints[filterSustainIndex].curve*10
  FilterSustain = filterEnvPoints[filterSustainIndex].level*100
  FilterRelease = filterEnvPoints[#filterEnvPoints].duration*1000
  FilterReleaseCurve = filterEnvPoints[#filterEnvPoints].curve*10
end

getFilterEnvPoints()

This approach has some drawbacks though. Script parameters work by changing Halion engine parameters. But it doesn’t work the other way around. When you add another node or change some values directly in zone editor the script won’t pick up the changes. So your macro page may be showing values that don’t reflect the changes you made in the editor. And in case of adding new nodes the script might be controlling different node than you might expect. That’s something to be aware of.

I’ve attached two presets. One with the same script as above. The other has a simple ui script that tries to address the changes of parameters from the zone editor. It’s not the best implementation though. You might notice some erratic behaviour.
Filter Env.zip (13.4 KB)