0
Answered

logarithmic level curves

Paul van Boven 7 years ago in Tips and Tricks updated 7 years ago 12

Hello,


Something I really miss are logarithmic curves for levels.

When I use a fader to control the lights, often you want more precision in the lower values.


So when you got a logarithmic curve, it's work so much beter.


Is this something whats planned for the future, or is there a way to make a level work logarithmic?


My regards,


Paul van Boven

Hi,

we have no plans for improving such a function in the editor, but you can do so right now by processing the sent value via the JS.

Hi,


That's too bad, it would be a big improvement when you can select linear or logarithmic in the level properties.

I can't imagine that I'm the only one with that issue.


But for now, how can I do it with use of JS?

Hello. 

You can use this script for example


//For exmaple x=value^2
function FromSlider(value)
{
  return Math.round(Math.pow(value, 2));
}

var OurSlider = IR.GetItem("Page 1").GetItem("Item 1");//it is our slider
IR.AddListener(IR.EVENT_ITEM_RELEASE, OurSlider, function()//release listener
{
   OurSlider.Text = FromSlider(OurSlider.Value);  //Get value from slider, convert it to value^2 and write to the slider text property
});

Thank you, I gonna try it.


Hello,


I have tried it to make a  logarithmic curve on a Level.

This works I adjust the value of the fader to max 1000 so it's more precise and adjust the script:


function FromSlider(value)
{
  return Math.round(Math.pow(value, 2)/10000);
}

var OurSlider = IR.GetItem("Page 1").GetItem("Item 1");//it is our slider
IR.AddListener(IR.EVENT_ITEM_RELEASE, OurSlider, function()//release listener
{
   OurSlider.Text = FromSlider(OurSlider.Value)+ '%';  //Get value from slider, convert it to value^2 and write to the slider text 

   OurSlider.Value = FromSlider(OurSlider.Value);
});


But now I got the following problem, I also need feedback from the KNX driver.

Now when I set the value to 25% that's when I set the fader to 50%, the feedback set the fader back to 25%.

How do I solve this?


And can I do this, does it work to set the KNX driver: 


OurSlider.Value = FromSlider(OurSlider.Value);



Hello

OurSlider.Value = FromSlider(OurSlider.Value); <- you can't do this, because slider range is still from 0 to 100. Slider value converted in script and if you write it in slider then it will be an error


about knx feedback. I receive big value from knx and you should convert it via reversed formula Math.round(Math.pow(value, 2)/10000); and set this value to the slider value

But how do I send the value that I now set as text to the slider to my KNX device?

And normaly I take the feedback from my KNX device and directly relate it to the fader, how must I reverse the Math formula then? So I've I understand it, I don't connect the feedback directly, but I must use a listener to get the value then recalculate it, then set the fader?


That's a lot of work for a simple logarithmic fader. @ Aleksandr Romanov time to implementing it to Iridium Studio ;-)

@ Paul van Boven you can create a topic in Idea section about it ))