From d2f954f73898b16618104741d365d95a6b63086c Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 2 Dec 2022 01:09:58 -0800 Subject: [PATCH] remove hanning window --- system/micd.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/system/micd.py b/system/micd.py index 150dcb9cbe..5a16392d89 100755 --- a/system/micd.py +++ b/system/micd.py @@ -25,12 +25,8 @@ def calculate_spl(measurements): def apply_a_weighting(measurements: np.ndarray) -> np.ndarray: - # Generate a Hanning window of the same length as the audio measurements - hanning_window = np.hanning(len(measurements)) - measurements_windowed = measurements * hanning_window - # Calculate the frequency axis for the signal - freqs = np.fft.fftfreq(measurements_windowed.size, d=1 / SAMPLE_RATE) + freqs = np.fft.fftfreq(measurements.size, d=1 / SAMPLE_RATE) # Calculate the A-weighting filter # https://en.wikipedia.org/wiki/A-weighting @@ -38,7 +34,7 @@ def apply_a_weighting(measurements: np.ndarray) -> np.ndarray: A /= np.max(A) # Normalize the filter # Apply the A-weighting filter to the signal - return np.abs(np.fft.ifft(np.fft.fft(measurements_windowed) * A)) + return np.abs(np.fft.ifft(np.fft.fft(measurements) * A)) class Mic: