remove hanning window

pull/26673/head
Shane Smiskol 2 years ago
parent e061565dcf
commit d2f954f738
  1. 8
      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:

Loading…
Cancel
Save