soundd: lower max volume breakpoint (#26673)

* revert tune

* remove hanning window

* retune from hanning window

* add hanning back

* update once reached 4096

* Revert "update once reached 4096"

This reverts commit 0898cbeec7.
This commit is contained in:
Shane Smiskol 2022-12-02 02:23:51 -08:00 committed by GitHub
parent d087fab2c0
commit de061eacbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 3 deletions

View File

@ -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);
}

View File

@ -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)