diff --git a/selfdrive/ui/soundd/sound.cc b/selfdrive/ui/soundd/sound.cc index 73d65eb1f7..f039511ff8 100644 --- a/selfdrive/ui/soundd/sound.cc +++ b/selfdrive/ui/soundd/sound.cc @@ -48,7 +48,7 @@ void Sound::update() { // scale volume with speed if (sm.updated("microphone")) { - float volume = util::map_val(sm["microphone"].getMicrophone().getFilteredSoundPressureWeightedDb(), 30.f, 55.f, 0.f, 1.f); + float volume = util::map_val(sm["microphone"].getMicrophone().getFilteredSoundPressureWeightedDb(), 30.f, 52.f, 0.f, 1.f); volume = QAudio::convertVolume(volume, QAudio::LogarithmicVolumeScale, QAudio::LinearVolumeScale); Hardware::set_volume(volume); } diff --git a/system/micd.py b/system/micd.py index 150dcb9cbe..57700e5927 100755 --- a/system/micd.py +++ b/system/micd.py @@ -26,8 +26,7 @@ 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 + measurements_windowed = measurements * np.hanning(len(measurements)) # Calculate the frequency axis for the signal freqs = np.fft.fftfreq(measurements_windowed.size, d=1 / SAMPLE_RATE)