Range- scaling faders - how to


Ok, so the range slider is not really a range slider…


Please, somebody tell me how i can restrict sliders to a certain range (i.e. 30-50 instead of the full 0-127)

Thank you very much:)

As far as I can tell, this has to be done with a little scripting.

With the macro page / canvas selected in the GUI tree, you will see the GUI scripting section in the properties box. It has 3 columns, “parameter”, “value” and “connection”, You might have to widen the tree section to see “connection”.

Click the “e” to open and paste this code and hit OK:

defineParameter('paramLimit', nil ,0 ,0 ,30)

In the knob / slider value box type @paramLimit. This connects the controller to the script parameter.

From the Halion parameter list, drag the parameter you want to control to the Macro page script section “connection” column. This should do the trick.

The knob or slider will still have its full range of motion but only output values up to 30.

The name “paramLimit” is determined by the user, so you can make it what you want, seeing as each name has to be unique on the macro page. Also, remember to change the name in the controller value box if you do change it.

Wow man…

You just defined the “scalable” macro controls…

Thank you so much:)!

I wonder if we can define the sliders values…

Example: instead of x-x , we can define values like 1/8 , 1/8t, 1/16 etc … Or ms… etc…

Also, assign “jump values” … So out of 1-10 ’ it jumps from 0 to 3 to 6 to 9…


defineParameter can create all kinds of parameters.

Something 1/4, 1/8 etc will likely be a table or string array parameter, but I’m still figuring out how they work.

I see…

I havent gotten to that yet myself… First question would be, once known if it is a string or a table or whatever- where would we place this ?nformation… Anywhere in the scriptbox? Hmm…

When it comes to scripting, you will have to go through the literature. I’m busy recapping some forgotten knowledge at this point, so it’s quite a task.

The thing to remember is that words like, “function”, “object” , “method” , “element” etc. aren’t just general verbs, nouns or adjectives, they are as specific as saying apple or pear.Getting a grip on these concepts is the key to the Macro designer in the long run.

On the Halion product page under the resources tab is the Developers link. It’s a good place to start.


Also, assign “jump values” … So out of 1-10 ’ it jumps from 0 to 3 to 6 to 9…

What is your aim with this?

Yeah, i see what u mean…

Even your “range” parameter helped out a lot and gave me great insight…
(Your range help actually made me understand a whole lot- so thx)

I saw that zerobrane thing you had posted and looked into it… But it didnt ring my bell atm…
I also checked the Sb dev sites… It wasnt really material to learn… No good examples… Not straight forward… Functions definitions spread over 11 short internet pages instead of one big list… Yadda yadda…idk…
If there was one good example per “major” thing that was actually useable in halion, that would be nice…
(Like your range example) as it stands now, it is just kinda a Lua manual/glossary etc… No hands on stuff for halion…

-The scale faders were one needed thing… I have this now thx to you…
The next thing would be “jump values”
My aim with this being: jumping from 1/4 to 1/8t to value X… To be able to have certain knobs etc jump from musically pleasing values to other nice values and not full range if it isnt needed…

Another important thing for me to know would be how to set what values are set in the object… (1/4, 1/8 , milliseconds, db values etc… - whatever value is needed and not only a generic numeric number)

Pretty much basic stuff… But there are no examples specifically for halion… Just lua gobbledigoop…(thats how i see it… - maybe im just not looking right;) )

Aaanyway… This whole process has somewhat humbled me and i do not feel as “entitled” as i did before when i was requesting things or whatever… I see how much work is going into it and i am somewhat amazed at all the hard work steinberg has put into it all…

Meh… Anyway… Onwards, eh? :stuck_out_tongue:

There could definitely be more examples of practical code application.

The examples in the new instrument macros are very long and confusing. It took me quite some time to figure out what they were doing and I’m still figuring out how they work.

Many of the manual examples show how the function works, but not always how they should be implemented.

Something to look out for in the Halion script function reference :

Available in: Controller, Processor. – (When it says Controller it’s a Macro / UI function, Processor is a Lua script module function. Some are available in both.)

The table/array parameter is not working as I would expect, but I’m posting about that later when hopefully, one of the Halion developers might drop by the forum.


I’m answering to what AposMus wrote:


The way he describes works as long as you do not use automation. The UI script is limiting the control, but the parameter in the engine still has the full range. If you assign this parameter to an automation channel it will go over the full range and I’m pretty sure this is not what you want.

There is a better way to limit the range of parameters. Instead of using the UI script, you must use the Lua Script module in the Program Tree. The basic procedure is as follows:

In the Lua Script module you define a script parameter. The change callback adjusts the engine parameter with setParameter. You can limit the range with defineParameter or with the change callback. The MacroPage control gets connected to the script parameter. If you assign an automation channel to it, it will have the correct range, because it uses the range you defined in the script. The script parameter serves as an interface between the control on the MacroPage and the engine parameter.

Here is some example code for the Lua Script module:

-- limit Osc 1.Mix of the Synth Zone to a range of 0 to 30%
defineParameter('p1', nil ,0 ,0 ,100, function() onP1Changed() end)

function onP1Changed()
  this.parent:getZone():setParameter("Osc 1.Mix", p1 * 0.3) -- range is 0 to 30 %



To anyone else struggling with Matthias’s script make sure you pay attention to the parameter. Its p1 and not pl. :blush:

Hi, I’ve had a go at restricting the range of the “Random Pitch parameter” from 0 - 100% to 0 - 0.85% to give a nice random detune and then assigned it to a knob using :-defineParameter(‘paramLimit’, nil ,0 ,0,0.85) this works fine (Thanks for the info) but what I really need is just the top and bottom settings (0 and 0.85%)
can I assign this to a simple button switch?
what do I have to change? :- I’m guessing it’s something to with this (nil ,0 ,0,0.85)
I worked out what the last one does (0.85 = 0.85%) but what do (nil ,0 ,0,0) refer to?


This should answer some of your questions: https://developer.steinberg.help/display/HSD/Creating+Parameters
It’s a numeric parameter.

But if you want a on/off switch then a boolean parameter might work better.
Try this:

defineParameter("Detune", nil, false, function()detuneChanged()end)

function detuneChanged()
  if Detune then
    this.parent:getZone():setParameter("Pitch.Random", 0.85)
    this.parent:getZone():setParameter("Pitch.Random", 0)

Or if you have a program with more than one zone:

defineParameter("Detune", nil, false, function()detuneChanged()end)

function detuneChanged()
  local zones = this.parent:findZones(true)
  for i, zone in ipairs(zones) do
    if Detune then
      zone:setParameter("Pitch.Random", 0.85)
      zone:setParameter("Pitch.Random", 0)