AudioAnalyzeRMS problem

Status
Not open for further replies.

MadMind

Well-known member
Hi everyone,

I've got a problem with the audioAnalyseRMS object :

I was expecting that the RMS object would have sent back a stable data flow when anylizing the noise signal provided in the audio library because it's supposed to make an "energetic average" but the values are constantly moving randomly like if it would just see the peak variation of the noise.

I was wondering if there was a trick or something I'm forgeting to do ? I need to have a stable rms signal as I want to compensate the rms volume between the original signal sent from the teensy and the microphone itself.

Thank you a lot to the community :)
 
The stability of the output will depend upon how frequently you read it. If you read it as frequently as available() returns true then you probably are just getting sqrt(signal^2), which is just the absolute value. Frequent reads will have a lot of variation.

The time between reads is the averaging interval, so increase your read interval to however long you want to average. For example, delay 100ms between reads and see if you like it. 100ms should pretty well stabilize noise between reads.

Keep in mind if you are using this to modify signal gain you will need to increment/transition the volume control in small steps from one reading to the next. Otherwise you will hear glitches with each RMS update.

HINT: It looks like the fade() function can be used to cross-fade between the two values according to the instructions in the Audio System Design Tool.
 
Hi,

Thx a lot for your quick reply. I'veseen that the signal seemed to be more stable when I increased the delay but I didn't know the theory behind. So it helps me a lot.

So, if I want to do peak detection in the variation of the RMS value, I have to find the right balance between the time delay and the variation of the signal, isn't it ?

Thx again mate,

PS : I can't really use the peak detection object in my project because it's part of a bigger problem and I need to use the RMS value.
 
Yes you have to find the right balance between rms read period (you call it delay).

As I mentioned before you can use a pair of fade objects to cross-fade between RMS readings like this:
get RMS value
fade1 on, with new RMS value
fade 2 off
get RMS value
fade2 on, with new RMS value
fade1 off

Fade times set to your RMS read delay.

Above should give you a linear ramp between RMS calculations.
 
Status
Not open for further replies.
Back
Top