Hi Experts.

I wanna normalize my sound stream by loudness (energy / pressure / intensity) , not by peaks.
How i do it ?
Is available Jack plugin for so what ?

What is (we hear as) "loudness" ?
RMS or +(average) or something else ?

Is somewhere available examples how to calculate RMS ?
Is it done simlpe by :

 int i, n;  double sums, rms;
 sums=0.0;  n=10;  rms=0;
 for(i=0; i<n;i++)
 {   sums = sums + ( (double)i * (double)i );  }
 rms = sqrt(sums / n);
 printf("          rms = %12.12f\n\n", rms );

Is so sipmple algo good enough for frequencies > 10 kHz ?
How to calculate RMS with hi-precision for frequencies > 10 kHz ?
With inerpolation or so ?

What is reference ( 0dB ) RMS for example for 16bit PCM signal 1024 samples ?
  sqrt( 1024*(0x7FFF ^ 2) / 1024 )  ==  sqrt( (0x7FFF ^ 2)  ) == 0x7FFF 
Is it simple  0x7FFF (32000 dec) ?

How to calc RMS for stereo signal ?
So , or somehow else ?
for(i=0; i<n;i++)
 {  ....
   sums = sampleL/2 + sampleR/2;
 }
In case operating with float point, what should be a bit faster,  / 2  or * 0.5 ?

How to gotta RMS value in dB ?
   20 x log10(Measured/Reference0_dB) 
or 10 x log10(Measured/Reference0_dB)  ??

Im just physics student and im new in DSP,
so pleaz no angree about simple or stuppid questions.

Any examples and hints welcomed.
Many Tnx in advance.
Alf







----