jaakkopasanen / AutoEq

Automatic headphone equalization from frequency responses
MIT License
12.89k stars 2.47k forks source link

Potential risk of permanent hearing damages in the higher frequency range #620

Closed T2hhbmEK closed 1 year ago

T2hhbmEK commented 1 year ago

Describe the bug Due to strong smoothing in the higher frequency range to the frequency response. There might exist strong spikes in the higher frequency range after applying compensation for some IEMs. These spikes may have peak values that is 10db larger than the target level. I'm concerning about the potential hearing damages. Correct me if it is an unnecessary.

To Reproduce For example. I have a pair of Etymotic ER4SR IEMs. There is a spike around 15000hz. However, after applying the EQ to IEF Neutral target, the spike's peak might be 10db larger than the target level. It makes me concerning about permanent hearing damages to my ears.

graph

For harman target.

python -m autoeq --input-dir="measurements/oratory1990/data/inear/Etymotic ER4SR" --output-dir="myresults/ER4SR" --compensation="compensation/harman_in-ear_2019v2_wo_bass.csv" --bass-boost=6 --parametric-eq --convolution-eq --fs=96000 --bit-depth=24

Etymotic ER4SR

The problem is less obvious with ER4SR for harman target. But I cannot comfirm that for other models. Currently, the strong smoothing over the higher freqency range and treat it as a single average level for compensation is the main concerning. I think the processing now is somewhat improvable.

Expected behavior It might make not too much senses to compensate spikes above 10hz to make the earphones sound better. However, it might make sense to compensate spikes above 10hz to avoid permannent hearing damages. Instead of smoothing it all and ignore spikes in the higher freqency range, I'd expect a better solution.

Additional context

T2hhbmEK commented 1 year ago

To creative a smooth equalized freq response for ER4SR. I patched the source code a little bit.

git format-patch -1

0001-remove-high-freq-smoothing.patch

From a9740bfec0fac81ff2746d53b1a71a8907ceaaba Mon Sep 17 00:00:00 2001
From: T2hhbmEK <T2hhbmEK@gmail.com>
Date: Wed, 8 Mar 2023 01:04:00 +0800
Subject: [PATCH] remove high freq smoothing

---
 autoeq/frequency_response.py | 5 +++--
 autoeq/peq.py                | 2 +-
 peq.yaml                     | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/autoeq/frequency_response.py b/autoeq/frequency_response.py
index 7f5350d73e..4bb58733e2 100644
--- a/autoeq/frequency_response.py
+++ b/autoeq/frequency_response.py
@@ -828,7 +828,7 @@ class FrequencyResponse:
                  limit_decay=0.0,
                  concha_interference=False,
                  window_size=1 / 12,
-                 treble_window_size=2,
+                 treble_window_size=1 / 12,
                  treble_f_lower=DEFAULT_TREBLE_F_LOWER,
                  treble_f_upper=DEFAULT_TREBLE_F_UPPER,
                  treble_gain_k=DEFAULT_TREBLE_GAIN_K):
@@ -866,7 +866,8 @@ class FrequencyResponse:
         peak_inds, peak_props = find_peaks(y, prominence=1)
         dip_inds, dip_props = find_peaks(-y, prominence=1)

-        if not len(peak_inds) and not len(dip_inds):
+        if True:
+        # if not len(peak_inds) and not len(dip_inds):
             # No peaks or dips, it's a flat line
             # Use the inverse error as the equalization target
             self.equalization = y
diff --git a/autoeq/peq.py b/autoeq/peq.py
index e37a9f45e2..1e9c348780 100644
--- a/autoeq/peq.py
+++ b/autoeq/peq.py
@@ -444,7 +444,7 @@ class PEQ:
         self._min_f_ix = np.argmin(np.abs(self.f - self._min_f))
         self._max_f_ix = np.argmin(np.abs(self.f - self._max_f))
         self._ix50 = np.argmin(np.abs(self.f - 50))
-        self._10k_ix = np.argmin(np.abs(self.f - 10000))
+        self._10k_ix = np.argmin(np.abs(self.f - 16000))
         self._20k_ix = np.argmin(np.abs(self.f - 20000))
         self._max_time = max_time
         self._target_loss = target_loss
diff --git a/peq.yaml b/peq.yaml
index f682734198..0250561eac 100644
--- a/peq.yaml
+++ b/peq.yaml
@@ -6,7 +6,7 @@ optimizer:
   min_std: null  # Letting optimizer finish
 filter_defaults:
   min_fc: 20
-  max_fc: 10000
+  max_fc: 20000
   min_q: 0.18248
   max_q: 6
   min_gain: -20
-- 
2.34.1

To obtain the equalization results. Run following bash commands.

python -m autoeq --input-dir="measurements/oratory1990/data/inear/Etymotic ER4SR" --output-dir="myresults/ER4SR" --compensation="compensation/harman_in-ear_2019v2_wo_bass.csv" --bass-boost=6 --parametric-eq --convolution-eq --fs=96000 --bit-depth=24 --parametric-eq-config=peq.yaml --treble-window-size="0.2"

The result graph. Etymotic ER4SR

Perfect!

Notes:

I can do this because the raw freq response of ER4SR is already extremely clean and smooth. Single Balanced Armature Driver. YES!

T2hhbmEK commented 1 year ago

Consider manufacture errors, to perfectly match high freq does not make much sense. The calibrated curve has a much higher level because ER4SR is designed to work in 10Hz-16kHz range. The level > 16kHz is marginally lower than target level. To smooth over the whole 20kHz range will make the high freq range get a much lower level, which results in a additional gain in the high freq range in the compensation.

The spike at around 15kHz makes contributes to the high freq energy of ER4SR to compensate the missing >16kHz range. Make the treble more audible.

In my opinion, its too much treble to compensate 16kHz IEMs to 20kHz target. So it might make sense to lower a bit treble gain. Following commands seems to create a neutral treble with original autoeq without any patchs.

python -m autoeq --input-dir="measurements/oratory1990/data/inear/Etymotic ER4SR" --output-dir="myresults/ER4SR" --compensation="compensation/harman_in-ear_2019v2_wo_bass.csv" --bass-boost=6 --parametric-eq --convolution-eq --fs=96000 --bit-depth=32 --max-gain=10 --treble-gain=0.5

Etymotic ER4SR