From 120296d8e2cb8b778cc49709620941c6572dfe85 Mon Sep 17 00:00:00 2001 From: Kuba <132459354+KubaPro010@users.noreply.github.com> Date: Fri, 18 Apr 2025 22:32:11 +0200 Subject: [PATCH] make bs412 fully rms --- lib/bs412.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/bs412.c b/lib/bs412.c index b4da6dd..dd029b6 100644 --- a/lib/bs412.c +++ b/lib/bs412.c @@ -1,11 +1,11 @@ #include "bs412.h" float dbr_to_deviation(float dbr) { - return (19000.0f * 0.70710678f) * powf(10.0f, dbr / 20.0f); + return 19000.0f * powf(10.0f, dbr / 20.0f); } float deviation_to_dbr(float deviation) { - return 20 * log10f((deviation + 1e-6f) / (19000.0f * 0.70710678f)); + return 20 * log10f((deviation + 1e-6f) / 19000.0f); } void init_modulation_power_measure(MPXPowerMeasurement* mpx, int sample_rate) { @@ -15,7 +15,7 @@ void init_modulation_power_measure(MPXPowerMeasurement* mpx, int sample_rate) { } float measure_mpx(MPXPowerMeasurement* mpx, float deviation) { - mpx->sample += deviation * deviation; + mpx->sample += deviation * deviation; // rmS mpx->i++; float avg_deviation = sqrtf(mpx->sample / mpx->i);