AnsweredAssumed Answered

RMS detection of 5 seconds of audio frames

Question asked by leonxp on Jul 23, 2013
Latest reply on Jul 30, 2013 by BrettG

Hi guys, I'm working on an ADAU1701 and I'd like to realize a RMS detector not just frame-by-frame, but taking into 5 seconds of audio data.
I think that "watch block" can help me in order to manage the time, but I don't know how to realize the RMS detection,

I thought to a loop in which accumulate RMS of each frame and at the end of 5 seconds, divide the accumulation by the counter of frame occurred in 5 seconds.

Anybody of you has some hints.

Thanks, regards,

Leo.

 

P.S. From a programming point of view it should be something like this:

 

t = 0;

count = 0;

RMS_inst = 0;

 

<<do it again as loop until shut down occurs>>

<<start>>

while(t<= 5 * Fs){

     RMS_inst = RMS_inst + RMS(input);

     count ++;

     t++;

}

RMS_avg = RMS_inst/count;

t = 0;

count = 0;

RMS_inst = 0;

<<end>>

 

where:

- FS is the sampling frequency

- RMS() is the function which computes RMS value of input

- RMS_inst the accumulation of RMS values

- count is the frame number occurred in 5 seconds

- t is the time instant in sense of sample (or frame)

- RMS_avg is my desired output

Outcomes