From 018f9490ce82f812d89048c2b44566b32c25d6ae Mon Sep 17 00:00:00 2001 From: KubaPro010 Date: Sat, 24 Jan 2026 10:16:33 +0100 Subject: [PATCH] allow +6 db on bs412 --- filter/bs412.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/filter/bs412.c b/filter/bs412.c index 338b646..6d0a2b9 100644 --- a/filter/bs412.c +++ b/filter/bs412.c @@ -50,7 +50,6 @@ float bs412_compress(BS412Compressor* mpx, float sample) { debug_printf("MPX power: %.2f dBr with gain %.2fx (%.2f dBr)\n", modulation_power, mpx->gain, deviation_to_dbr(avg_deviation * mpx->gain)); #endif mpx->sample_counter = 0; - if(mpx->can_compress == 0) mpx->second_counter++; } if(mpx->can_compress == 0 && mpx->second_counter > BS412_TIME) { @@ -73,7 +72,7 @@ float bs412_compress(BS412Compressor* mpx, float sample) { mpx->gain = mpx->release * mpx->gain + (1.0f - mpx->release) * target_gain; } - mpx->gain = fmaxf(0.0f, fminf(sqrtf(2), mpx->gain)); + mpx->gain = fmaxf(0.0f, fminf(sqrtf(2)*2.0f, mpx->gain)); float output_sample = sample * mpx->gain; if(deviation_to_dbr(avg_deviation * mpx->gain) > mpx->target && deviation_to_dbr(avg_deviation) < mpx->target) { @@ -81,7 +80,7 @@ float bs412_compress(BS412Compressor* mpx, float sample) { float overshoot_dbr = deviation_to_dbr(avg_deviation * mpx->gain) - mpx->target; float reduction_factor = powf(10.0f, -overshoot_dbr / 10.0f); mpx->gain *= reduction_factor; - mpx->gain = fmaxf(0.0f, fminf(sqrtf(2), mpx->gain)); + mpx->gain = fmaxf(0.0f, fminf(sqrtf(2)*2.0f, mpx->gain)); } mpx->sample_counter++;