What are the units?

When dealing with sample values, we normally work on a linear scale range of +/- 1, or a dB range relative to full scale (where 0dB = full scale).

There's a huge difference between multiplying by 5dB and multiplying by "5" (linear scale).

Your are right! In my example I was dealing with linear values totally abstracted from the audio world (in which, as you said, usually samples are in the range [-1,1]).

It is now clear to me where the error was: following your instructions I calculated the amplification factor as the

**difference** between the original RMS and the target RMS but, due to the fact they were expressed in linear scale, I would perform a

**division**, thanks to the logarithm difference property.

Let's say:

RMSol ---> original RMS in linear scale

RMSod ---> original RMS in logarithmic scale

RMStl ---> target RMS in linear scale

RMStd ---> target RMS in logarithmic scale

Fl ---> amplitude factor in linear scale to modify the track from original RMS to target RMS

Fd ---> amplitude factor in logarithmic scale to modify the track from original RMS to target RMS

RMSod = 20*log(RMSol)

RMStd = 20*log(RMStl)

Fd = RMSod - RMStd = 20*log(RMSol) - 20*log(RMStl) = 20 * (log(RMSol) - 20*log(RMStl) ) = 20 * (log(RMSol/RMStl))

Fl = 10^(Fd/20) = 10^( (20*log(RMSol/RMStl))/20) = 10^log(RMSol/RMStl) = RMSol/RMStl

And that's the point: working in linear scale, the factor must be calculated as the division of original RMS by the target RMS.

Now my example works:

Fl = 10/6.55 = 1,5267

5 --> 5*1.5267 = 7.6336

2 --> 2*1.5267 = 3.0534

10 --> 10*1.5267 = 15.2671

RMStd = sqrt( (7.6336^2 + 3.0534^2 + 15.2671^2) / 3 ) = 10.01

Said that, I want to thank you again for spending your time to help me to find the right way, you are a very kindly person.