esp32-i2s-slm icon indicating copy to clipboard operation
esp32-i2s-slm copied to clipboard

Modify code for longer LEQ_PERIOD

Open KianYeo opened this issue 4 years ago • 1 comments

Hi,

The current program calculates and displays the LEQ every 1 second. How can I modify the code to display the LEQ every 5 minutes instead?

If I were to change LED_PERIOD to 300, then SAMPLES_LEQ will become 14,400,000, and the accumulated Leq sum would probably overflow?

I am not familar with calculating LEQ, but I presume I can't just add up the LEQs for every one second and divide it by 300 (after 5 minutes) to get the average LEQ for 5 minutes right?

KianYeo avatar Apr 21 '20 05:04 KianYeo

Hi @KianYeo, you can't add-and-average Leq values, you would need to integrate them (see: http://www.gracey.co.uk/basics/leq-b1.htm). However, even with large LED_PERIOD values, it is unlikely to overload double-precision floating-point Leq_sum_sqr (max ~1.7e+308)...

ikostoski avatar Apr 21 '20 06:04 ikostoski