ARDOUR.DSP.compute_RMS ()

Another NEW companion for the existing function ARDOUR.DSP.compute_peak ()

float compute_peak (FloatArray, unsigned int, float)

http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:DSP

Is that a feature request?

There is currently no function in libardour itself that can be directly exposed as Lua-binding.
The problem is normalization and incremental computation (integration) of the RMS, you can’t just take the max of

$ \sqrt{ \frac{1}{n} \sum\limits_{i=0}^{n-1} {v(i) ^ 2} } $

in every cycle.

What is the use-case? Do you need a running average or sum-of-squares or some metering standard with fall-off or dedicated integration time?

I need a running average, better than the peak. Perhaps even a simple arithmetic mean (also as lua function implementation if performance permits).

For a multichannel application with many monophonic sources, I wrote a DSP plugin in lua to reallocate/remix DYNAMICALLY inputs to outputs (basically from 12 inputs to 6 outputs). The purpose is to act independently of the 12 input chromatic tone sounds (C, C#, D, D#, …, B) )avoiding intermodulation digital mix distortions that are further accentuated by the use of saturation plugins such as valve emulation ones. Each input channel can contain only one chromatic sound along with all the upper and lower octave ranges.

The problem arises when the input number is 12 and outputs number is less than 12. In the case of many simultaneous input sounds, output channels are all allocated (considering also that the decay of a sound can last several seconds) and a compromise is needed to make room for new sounds even by derogating from the octave rule.

The new rule is to choose the weaker output channel that is likely to be extinct:
ARDOUR.DSP.compute_peak (ous[c], n_samples, 0)