From f58e278c857150deb4f382450343bfb75c84ba67 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sat, 23 Jul 2022 00:03:22 +0200 Subject: [PATCH] Fix offsets in threshold calculations --- plugins/spectral_compressor/src/compressor_bank.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/spectral_compressor/src/compressor_bank.rs b/plugins/spectral_compressor/src/compressor_bank.rs index bcead84b..fc05c967 100644 --- a/plugins/spectral_compressor/src/compressor_bank.rs +++ b/plugins/spectral_compressor/src/compressor_bank.rs @@ -586,7 +586,7 @@ impl CompressorBank { .iter() .zip(self.downwards_thresholds.iter_mut()) { - let offset = log2_center_freq - log2_freq; + let offset = log2_freq - log2_center_freq; let threshold_db = intercept + (slope * offset) + (curve * offset * offset); // This threshold may never reach zero as it's used in divisions to get a gain ratio // above the threshold @@ -605,7 +605,7 @@ impl CompressorBank { .iter() .zip(self.upwards_thresholds.iter_mut()) { - let offset = log2_center_freq - log2_freq; + let offset = log2_freq - log2_center_freq; let threshold_db = intercept + (slope * offset) + (curve * offset * offset); *threshold = util::db_to_gain(threshold_db).max(f32::EPSILON); }