Help with Parameter Expression

Official support for: meldaproduction.com
RELATED
PRODUCTS

Post

Hi all,
I have 3 parameters assigned to a MP and I'd like the values of the 2nd and the the 3rd ones to be respectively 90% and 10% of the first one.
I tried the following expression for the 2nd and 3rd parameters:
p1*0.9 and p2*0.1
x*0.9 and x*0.1
but the results are completely off. It seems that there is still an interaction the the parameter ranges but I can't figure out what it is exactly.
Can anyone help me with this ?
Thanks

If it's relevant, it's in MSF 17.05.

Post

p1 is the first parameter in the "parameter list" (but I cannot remember where the numbered parameters are listed ;)).

If you are using the first MP, try mp1*0.9 and mp1*0.1.
DarkStar, ... Interesting, if true
Inspired by ...

Post

Thanks.
As I understand p# are the values of the parameters assigned to the current MP (on the left in the MP window) and mp# represent the values of other MPs.
But I might be wrong.

Post

@yop21
Your expressions are correct. However, there's another issue. Multiparameters always use a linear range from 0 to 1. But when this range is applied to other parameters, it goes through a transformation that often creates a curve. The shape of that curve depends on the target parameter. For example, frequency or time parameters usually use a logarithmic or exponential scale. So, 50% of a 20 Hz to 20,000 Hz range is not 10,010 Hz, but around 632.5 Hz. This is why your results seem off.

Post

@Antisha
Thanks, I understand for frequency calculations but in my case, all parameters used in the expressions are milliseconds, so totally linear. What I'm trying to achieve is that Hold (p2) and Release(p3) of the Global Volume Envelope are automatically set respectively the 9/10th and 1/10th of Env1 Decay (p1). Is there a way to make it linear ?

Post

Time is technically linear, but in MeldaProduction plugins, a curve is applied to time knobs for a better user experience. For example, 50% of a 0–10000 ms range is actually 625 ms, not 5000 ms. This behavior ensures finer control over shorter time values, which is usually more musically useful.
I’ve made a working solution — copy it and see if it does what you need.

Code: Select all

$eNq9l81u20YQx8dBC+TaNyAQFEgCJ+TK+nAOrbu2aEeoaSui7LA9BFiTI2nhJVfZXSqSD+0z9NLn6OP02qIP0BcoUKwoSpYaxZJaVCftzu8-O9zPGQiOoygIZZ4lpyw2Uk00GsOzvgb6BMgefXIm5A0TustubPMaleYygyp8-gXQoNVstZXsK5aeDFjWRz9jNwKBAF3qPm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-7tZrty5IZVR--2ZwXL1889VX4M7dhYYZhOgMM4XgRsXZBjeiyvB4tr9sU9gC0QxScKNTZCZXaIuSaFbrlUcH1ob978ZxI9qeTar9r4ZAO9YfeRQFzCg+XhiLWa5AdJmbAGiT66Fgk4CNeZqnQMCN3vLEDAKIQpmrGG0tjD0uDKqi3nVd94e-AXQdy3c=

Post

Thanks! It works sort of. It's not very accurate, but it's good enough for what I'm trying to do.
But these formulas are very complex, and the result is a bit rough compared to the simplicity of what they're supposed to calculate (0.9*X and 0.1*X) :wink:
Where did you find this information? The official documentation is pretty brief...

Post

Well, I actually overcomplicated the formula 😄 It can be simpler, like this:
((x^4)*0.9)^0.25
And probably even simpler (I'm not a math expert) - but clearly, it can't just be x*0.9, due to the parameter curves, as I already explained.

If you use x as the base for the calculation, precision is perfect (at least on my end), assuming the parameter ranges are full and no transformations are turned on.
However, if you use p1 directly in the formula, the results seem less precise - as you noticed. It probably shouldn't behave like that...
Maybe it's due to some rounding, internal value mapping (there are range modes for parameters), or possibly even a bug.

Thanks for your feedback.

Post

Given that the parameter value (0..1) is transformed in some way depending on the type of parameter (time, frequency, gain etc) then it should be possible (with a fair bit of work) to work out the equation for the transformation.

This equation could then be reversed (inverted?) e.g. from y = x /2 +4 to x = y *2 -8 and used in the Expression Editor or in the Transformation graph.

But a much better way would be for MedlaProduction to publish the various transformations as presets for the Transformation Shape graph (with names such as "MP to time" etc). This would make use of the Expressions much easier / intuitive for the users.
DarkStar, ... Interesting, if true
Inspired by ...

Post

Antisha wrote: Thu Aug 07, 2025 4:34 pm Well, I actually overcomplicated the formula 😄 It can be simpler, like this:
((x^4)*0.9)^0.25
And probably even simpler (I'm not a math expert) - but clearly, it can't just be x*0.9, due to the parameter curves, as I already explained.

If you use x as the base for the calculation, precision is perfect (at least on my end), assuming the parameter ranges are full and no transformations are turned on.
However, if you use p1 directly in the formula, the results seem less precise - as you noticed. It probably shouldn't behave like that...
Maybe it's due to some rounding, internal value mapping (there are range modes for parameters), or possibly even a bug.

Thanks for your feedback.
We could go even faster in this case:
m^0.25 * x
where m is the desired multiplier/factor (0.1, 0.9, etc)

Post

vanerio wrote: Sun Aug 10, 2025 1:33 pm We could go even faster in this case:
m^0.25 * x
where m is the desired multiplier/factor (0.1, 0.9, etc)
Very nice, thank you for the correction!
Since the curve that maps the 0–1 range to a 0–10000 ms time range (with 50% = 625 ms) is simply
𝑥^4, this is the most straightforward way to linearize it and calculate the proportion.

Post

Hi again Antisha!
I was trying to convert rate values to linear, so I need to find the original mapping functions used and while I found some equations that match perfectly, I suposse that some cleaner alternatives were used insted.
So would it be possible to know the formulas Melda plugins map the Rate knob values with? I mean rate like in MTremolo, MVibrato, etc.
I am interested in both 100 Hz and 20 Hz versions:
Right now this is what I have (my dirty versions, that still match though):
100 HZ: 10^(4x-4)
20 Hz: 2000^(x-1)

Thank you!!

Post

Ah ha, I think I've worked out how to do it ....

(a) I made some measurements in Reaper, for automating a Frequency
(b) I created a scatterplot graph in LibreOffice Calc
(c) I generated a trendline and equation in Calc:
Param value = 0.1446 *ln(Freq) - 0.4324
(d) I rearranged that equation to convert the MultiParam value to a Frequency:
Freq = EXP((Param value+0.4324)/0.1446)
(e) I then combined the two, to convert the MultiParam value to a Frequency, apply the Factor (0.9 or 0.5 etc) to the frequency, then convert the frequency to a new Param value
New Param Value = MIN(1,MAX(0,0.1446*LN((EXP((MultiParam value+0.4324)/0.1446))*Factor)-0.4324))
(f) I used CoPilot to simplify that equation. to:
New Param Value = MIN(1, MAX(0, MultiParam value + 0.1446 * LN(Factor)))

The Calc graph is:
curve.png

The Multiparameter details are:
Shifts.png
These use the value of the first target parameter but it is better to use the MultiParameter value. In this example, replace "p1" by "mp1".


and the result:
temp.gif
You do not have the required permissions to view the files attached to this post.
Last edited by DarkStar on Wed Aug 13, 2025 10:05 pm, edited 2 times in total.
DarkStar, ... Interesting, if true
Inspired by ...

Post

And here are the expressions for 2 Delay parameters (in MDelayMB):
MIN(1,MAX(0,0.1*((10*mp21)^4*0.9)^0.25))
MIN(1,MAX(0,0.1*((10*mp21)^4*0.5)^0.25))


As above, the mp21 value is converted to a time, the factor is applied to that time, and the new time is converted to the target parameter value. The equations were derived using the same procedure as described above.

They also match antisha's method.
DarkStar, ... Interesting, if true
Inspired by ...

Post

And for a Gain, range -24dB to +24dB, linked to Multiparameter 2:
MIN(1,MAX(0,1/48*((mp2-0.5)*48*0.9)+0.5))
MIN(1,MAX(0,1/48*((mp2-0.5)*48*0.5)+0.5))
DarkStar, ... Interesting, if true
Inspired by ...

Post Reply

Return to “MeldaProduction”