posts: Add a section on running autoeq to parametric autoeq

This commit is contained in:
Sanchayan Maity 2024-05-08 12:49:50 +05:30
parent a6c5f12845
commit 1f03b8353f
Signed by: sanchayanmaity
GPG key ID: 6F6A0609C12038F3

View file

@ -26,11 +26,6 @@ Filter 1: ON PK Fc 20 Hz Gain -1.3 dB Q 2.000
Filter 2: ON PK Fc 31 Hz Gain -7.0 dB Q 0.500
Filter 3: ON PK Fc 36 Hz Gain 0.7 dB Q 2.000
Filter 4: ON PK Fc 88 Hz Gain -0.4 dB Q 2.000
Filter 5: ON PK Fc 430 Hz Gain 1.6 dB Q 0.700
Filter 6: ON PK Fc 3200 Hz Gain -1.5 dB Q 0.700
Filter 7: ON PK Fc 7800 Hz Gain -3.9 dB Q 2.000
Filter 8: ON PK Fc 13000 Hz Gain -6.7 dB Q 2.000
Filter 9: ON PK Fc 15000 Hz Gain 9.1 dB Q 0.700
```
`Fc` is the frequency, `Gain` is the amount with which the signal gets boosted or attenuated around that frequency. `Q` factor controls the bandwidth around the frequency point. To be more precise, `Q` is the ratio of center frequency to bandwidth. If the center frequency is fixed, the bandwidth is inversely proportional to Q implying that as one raises the Q, the bandwidth is narrowed. Q is by far the most useful tool a parametric EQ offers, allowing one to attenuate or boost a narrow or wide range of frequencies within each EQ band.
@ -43,6 +38,34 @@ Now, this needs to be converted manually into something which [filter-chain](htt
To simplify this, a simple PipeWire module is implemented which reads a parametric EQ text file like preceding and loads filter chain module while translating the inputs from the text file to what the filter chain module expects.
Before writing the PipeWire module, generate such a parametric equalizer file for a selected headphone and target using [AutoEq](https://github.com/jaakkopasanen/AutoEq). While the web interface at [autoeq.app](https://autoeq.app/) can be used, below section covers how to do this from the command line.
# Automatic headphone equalization
Installation instructions for AutoEq can be found [here](https://github.com/jaakkopasanen/AutoEq?tab=readme-ov-file#installing). Take the example of Beyerdynamic DT1990 headphone and Diffuse Field 5128 target. For brevity sake, what target curve to select and why isn't covered here.
Measurements can be found in [measurements](https://github.com/jaakkopasanen/AutoEq/tree/master/measurements) directory and targets can be found in [targets](https://github.com/jaakkopasanen/AutoEq/tree/master/targets) directory. Note that if measurements aren't available for the selected headphone, earphone, or in-ear monitor, AutoEq can't be used. `oratory1990` and `crinacle` are well known folks in the audiophile community who have provided measurements for various popular headphones and in-ears. `oratory1990`'s measurements are considered below.
Create a results directory `dt1990-results` and then execute the below command.
```bash
python -m autoeq --input-file="measurements/oratory1990/data/over-ear/Beyerdynamic DT 1990 (balanced earpads).csv" --output-dir="dt1990-results" --target="targets/Diffuse field 5128.csv" --parametric-eq --fs=44100,48000
```
The results directory `dt1990-results` has the below output.
```bash
Beyerdynamic DT 1990 (balanced earpads).csv
Beyerdynamic DT 1990 (balanced earpads).png
Beyerdynamic DT 1990 (balanced earpads) GraphicEQ.txt
Beyerdynamic DT 1990 (balanced earpads) ParametricEQ.txt
README.md
```
The `Beyerdynamic DT 1990 (balanced earpads) ParametricEQ.txt` file has the parametric equalizer configuration needed which can be given to the PipeWire module discussed next. `README` has some information and recommendation.
Similar process can be followed for in-ear monitors as well.
# Module
A module is a client in a shared library `.so` file which shares a PipeWire context with the loading entity. PipeWire context is an object which manages all locally available resources. See [here](https://docs.pipewire.org/group__pw__context.html#details).
@ -63,16 +86,20 @@ The focus is on these two tasks and ignore rest of the ceremony around writing t
# Parsing parametric equalizer configuration
A Parametric EQ configuration generated via *AutoEq* or *Squig*, might look like below. This configuration is converted to match the module args.
Below is the parametric equalizer configuration that was generated in the second section of this post. This configuration is converted to match the module args.
```
Preamp: -2.4 dB
Filter 1: ON PK Fc 52 Hz Gain 1.0 dB Q 0.600
Filter 2: ON PK Fc 210 Hz Gain -0.5 dB Q 1.800
Filter 3: ON PK Fc 390 Hz Gain -0.5 dB Q 1.600
Filter 4: ON PK Fc 2100 Hz Gain 1.3 dB Q 1.200
Filter 5: ON PK Fc 3600 Hz Gain -1.7 dB Q 2.000
Filter 6: ON PK Fc 4900 Hz Gain 3.0 dB Q 2.000
Preamp: -6.0 dB
Filter 1: ON LSC Fc 105 Hz Gain -5.2 dB Q 0.70
Filter 2: ON PK Fc 206 Hz Gain -5.3 dB Q 0.51
Filter 3: ON PK Fc 4532 Hz Gain 5.5 dB Q 0.41
Filter 4: ON PK Fc 791 Hz Gain 2.0 dB Q 1.43
Filter 5: ON PK Fc 6829 Hz Gain -3.8 dB Q 2.04
Filter 6: ON HSC Fc 10000 Hz Gain 3.1 dB Q 0.70
Filter 7: ON PK Fc 8944 Hz Gain -1.4 dB Q 2.88
Filter 8: ON PK Fc 3751 Hz Gain -1.6 dB Q 5.97
Filter 9: ON PK Fc 4458 Hz Gain 1.5 dB Q 6.00
Filter 10: ON PK Fc 39 Hz Gain -0.2 dB Q 1.88
```
For every line read, a node entry like below is generated.
@ -95,7 +122,7 @@ When a pre-amp gain is required, which is usually the case when applying EQ, the
type = builtin,
name = eq_band_1,
label = bq_highshelf,
control = { Freq = 0, Gain = -2.4, Q = 1.0 },
control = { Freq = 0, Gain = -6.0, Q = 1.0 },
}
```
@ -105,8 +132,8 @@ Similarly, for `Filter 1` this would be
{
type = builtin,
name = eq_band_2,
label = bq_peaking,
control = { Freq = 52, Gain = 1.0, Q = 0.600 },
label = bq_lowshelf,
control = { Freq = 105, Gain = -5.2, Q = 0.7 },
}
```