From 76ea71d6bbd3677b5b53ec77becb7a27ccf38d41 Mon Sep 17 00:00:00 2001 From: Sergiy Matusevych Date: Thu, 11 Nov 2021 07:50:40 -0800 Subject: [PATCH] fix incorrect RMS calculation - issue #44 --- audiolib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audiolib.py b/audiolib.py index f4d889dce5e..4af82dd01f0 100644 --- a/audiolib.py +++ b/audiolib.py @@ -202,7 +202,7 @@ def active_rms(clean, noise, fs=16000, energy_thresh=-50): sample_end = min(sample_start + window_samples, len(noise)) noise_win = noise[sample_start:sample_end] clean_win = clean[sample_start:sample_end] - noise_seg_rms = 20*np.log10((noise_win**2).mean()+EPS) + noise_seg_rms = (noise_win**2).mean()**0.5 # Considering frames with energy if noise_seg_rms > energy_thresh: noise_active_segs = np.append(noise_active_segs, noise_win)