Re: [LAD] Calculate R M S

From: Jens M Andreasen <jens.andreasen@email-addr-hidden>
Date: Fri Feb 18 2011 - 03:15:59 EET

On Wed, 2011-02-16 at 19:51 +0200, Alfs Kurmis wrote:
>
> 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 ?

What we /hear/ as loudness are the transients, which you can detect by
summing up the delta values between samples. The following hack
visualizes that the commercials really are annoyingly loud compared to
regular programming:

// samplerate 96k, periodsize 256, updates 25 per second

       
       static long long sum = 0;
       static int previous = 0;
       static int count = 0;

       for(i = 0; i < 256; i++)
         {
           long long x = (in_buffer[i][0] - previous);
           sum += llabs(x);
           previous = in_buffer[i][0];

           if(++count > (96000/25))
             {
               unsigned int s = sum>>31;

               fputs
                 ("\r : : : : : : : ] \r[",
                  stdout);

               while(s)
                 putchar('|'),
                   s >>= 1,s += (s>>1)+(s>>2);

               fflush(stdout);

               sum -= sum >>3;
               count = 0;
             }
         }

>

-- 
A Charlatan with a Cembalo and other friends of The Little Matchgirl
http://mx44.linux.dk/charlatan/
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Fri Feb 18 04:15:03 2011

This archive was generated by hypermail 2.1.8 : Fri Feb 18 2011 - 04:15:03 EET