easyeffects icon indicating copy to clipboard operation
easyeffects copied to clipboard

Feature request: Add support for GraphicEQ importing

Open Cpt-Dingus opened this issue 3 years ago • 32 comments

Hey there, APO setting importing already exists but it sadly does not include importing GraphicEQ settings. Would it be possible to add it?

Sample: GraphicEQ: 5.53608 0.8; 13.2 8.2; 26.7 -6.2; 62.7 -7; 247.2 8.2; 1326.8 -5.8; 3219.8 5.4

Cpt-Dingus avatar Sep 07 '22 15:09 Cpt-Dingus

Hello @Cpt-Dingus. Can you link its format documentation?

Digitalone1 avatar Sep 07 '22 15:09 Digitalone1

Here you go

Cpt-Dingus avatar Sep 07 '22 16:09 Cpt-Dingus

It's doable with regular expressions: https://regex101.com/r/EQY8BZ/1

But isn't it specified which filter is applied?

Update: https://regex101.com/r/JRwf4G/1

Digitalone1 avatar Sep 07 '22 17:09 Digitalone1

The filter mentioned is just a basic EQ, not aware of any other possible filters to be applied (talking about graphiceq that is)

Cpt-Dingus avatar Sep 07 '22 17:09 Cpt-Dingus

So it's just PK, MODAL or PEQ in APO format? A bell filter?

https://github.com/wwmm/easyeffects/blob/master/src/equalizer_ui.cpp#L37

It's missing the quality also (which I suppose we will set to our default value).

Digitalone1 avatar Sep 07 '22 17:09 Digitalone1

Not sure about the exact type, the default type & quality should do the job, no?

Cpt-Dingus avatar Sep 07 '22 17:09 Cpt-Dingus

Dug around a bit, I found quite a few references to the filter type being PEQ.

Cpt-Dingus avatar Sep 07 '22 17:09 Cpt-Dingus

Not sure about the exact type, the default type & quality should do the job, no?

I suppose they do.

Dug around a bit, I found quite a few references to the filter type being PEQ.

Okay, it's bell filter in LSP.

Digitalone1 avatar Sep 07 '22 18:09 Digitalone1

Okay, it's bell filter in LSP.

Yes. It will have to be done with bell. From a technical point of view the correct thing to be done would be to use a graphical equalizer with the same number of bands and algorithm instead of using a parametric equalizer. Graphic equalizers are not necessarily a parametric equalizer with bell filters at each center frequency. But besides the fact we do not have a graphic equalizer in EasyEffects for each number of bands and implementation algorithm something slightly different may be happening under the hoods when a graphical equalizer is written. It is not viable for us at this moment to deal with graphical equalizers. For each number of bands we would need a different one.

wwmm avatar Sep 07 '22 18:09 wwmm

It's missing the quality also (which I suppose we will set to our default value).

That is where technical differences start to happen. We would have to take a look at what APO is doing to the band width/quality. Depending on the level of overlap between bands different values will be used. That is assuming they are actually implementing a graphic equalizer through peak filters.

wwmm avatar Sep 07 '22 18:09 wwmm

So what do you suggest? Just applying frequency and gain with bell filter and default quality or not implementing the conversion because we can't match graphic equalizer behaviour?

Digitalone1 avatar Sep 07 '22 18:09 Digitalone1

So what do you suggest? Just applying frequency and gain with bell filter and default quality

This. Users will just have to accept the fact that it is not going to be 100% equal to APO unless APO is also building its graphic equalizer this way. Our solution will be close but probably not exactly the same thing.

wwmm avatar Sep 07 '22 19:09 wwmm

In my opinion it doesn't have to be the exact same, I just asked as this can simplify importing cross-os EQ settings drastically.

Cpt-Dingus avatar Sep 07 '22 19:09 Cpt-Dingus

Implemented. Please test.

Digitalone1 avatar Sep 13 '22 21:09 Digitalone1

Sorry for the late response, @Digitalone1, I didn't have access to my Linux install.

Just updated to the latest version on flatpak (6.3.0) and using "Load APO Preset" with a .txt file containing a graphiceq string did not work, I might just be using the wrong button here though.

I tried building from source but Ubuntu 20,04 can't compile it because of a lacking dependency (gtk4)

Cpt-Dingus avatar Oct 28 '22 21:10 Cpt-Dingus

Just updated to the latest version on flatpak (6.3.0) and using "Load APO Preset" with a .txt file containing a graphiceq string did not work, I might just be using the wrong button here though.

In this case let's reopen this. @Cpt-Dingus could you attach here on github the file you tried to import?

wwmm avatar Oct 28 '22 21:10 wwmm

Hey there, here you go.

test.txt

Cpt-Dingus avatar Oct 28 '22 22:10 Cpt-Dingus

If I remember correctly, the latest release does not have the GraphicEQ import and the new version 7.0 has not been released yet.

Digitalone1 avatar Oct 28 '22 22:10 Digitalone1

Ah, alright then - will wait for 7.0 to update, or might just upgrade my ubuntu release to 22.04 to get gtk4 support and try building directly from source.

Cpt-Dingus avatar Oct 28 '22 22:10 Cpt-Dingus

If I remember correctly, the latest release does not have the GraphicEQ import and the new version 7.0 has not been released yet.

Oh... I forgot about it. Let's close this again :smile:

wwmm avatar Oct 28 '22 22:10 wwmm

Maybe it is time to do a new release...

wwmm avatar Oct 28 '22 22:10 wwmm

Maybe it is time to do a new release...

Maybe at a commit before the speex plugin. It has to be tested...

Digitalone1 avatar Oct 28 '22 23:10 Digitalone1

It has to be tested...

We can wait for more days. But I have been using it lately and the voice detection and its noise reduction are working way better than I initially expected.

wwmm avatar Oct 28 '22 23:10 wwmm

Just booted up linux, can confirm the GraphicEQ feature works splendid. Well done, thanks!

Cpt-Dingus avatar Dec 02 '22 22:12 Cpt-Dingus

Do I understand correctly that EqualizerAPO GraphicEq imports were added to EasyEffects and the implementation is done by creating bell filters at each frequency of the GraphicEq string with respective gains? What is the default quality that's mentioned earlier here?

The EqualizerAPO implementation is quite a bit different than using bell filters. It actually creates a minimum phase FIR filter with 16384 taps, meaning the frequency response of the FIR filter follows the curve defined by the GraphicEq string very precisely.

If the GraphicEq string defines a large number of frequencies and quality is fixed to for example 1.41, the resulting frequency response will be massively different from the curve specified by the GraphicEq string. This is of course because the bells overlap each other and if the bell widths are a lot greater than the distance between the bell center frequencies.

If bell filters are the only way to implement GraphicEq, and you really want to support it, then I'd suggest calculating the quality separately for each filter. One approximation for this could be for each filter to:

  1. Calculate distance from center frequency to previous filter's center frequency in octaves
  2. Calculate distance from center frequency to next filter's center frequency in octaves
  3. Average the two to get N
  4. Calculate quality from bandwidth with sqrt(2^N) / (2^N - 1)

This is not going to give an exact result but more or less as good as can be done with bell filters. Inaccuracy becomes greater if the distances are very unevenly spaced in logarithmic scale.

jaakkopasanen avatar Sep 23 '23 08:09 jaakkopasanen

Do I understand correctly that EqualizerAPO GraphicEq imports were added to EasyEffects and the implementation is done by creating bell filters at each frequency of the GraphicEq string with respective gains?

Yes. It is definitely not ideal. But as usually graphical eq plugins have a fixed number of bands wrapping multiple different plugins isn't viable on our side. So we are trying to get away with a parametric equalizer.

What is the default quality that's mentioned earlier here?

For reasons that even I do not remember our default is 4.26. I do not remember any special reason for it to be set to this value.

The EqualizerAPO implementation is quite a bit different than using bell filters. It actually creates a minimum phase FIR filter with 16384 taps, meaning the frequency response of the FIR filter follows the curve defined by the GraphicEq string very precisely.

I see. The parametric equalizer we use is from Linux Studio Plugins and it has a FIR mode. But I do not know if it would help to approximate APO's graphic equalizer behavior. @sadko4u is there any chance or using one of lsp graphical equalizers would be the only way? But as APO seems to support an arbitrary number of bands in its graphical equalizer it does not seem viable to use the ones from lsp.

This is not going to give an exact result but more or less as good as can be done with bell filters. Inaccuracy becomes greater if the distances are very unevenly spaced in logarithmic scale.

If there is nothing better the way will be to do it.

wwmm avatar Sep 23 '23 14:09 wwmm

  1. Equalizer APO has straighforward book implementations of filters. At least it is clean from here: https://github.com/mirror/equalizerapo/blob/7aece1b788fce5aa11873f3842a0d01f7c78454b/filters/BiQuad.cpp#L49-L126
  2. LSP introdices the same book filters under the 'APO DR' mode.
  3. LSP can work in IIR mode which is default. Additional FIR modes are available:
  • FIR (taking the impulse response of analog filter and converting to IIR),
  • FFT (taking the frequency response and building the FIR filter based on it)
  • SPM (spectral processing mode, processing the spectrum of the signal in-place).
  1. LSP does not aim to reproduce the behaviour of Equalizer APO. We support reading of it's config which is also very similar to the text configuration file of the RoomEQ Wizard.

sadko4u avatar Sep 23 '23 15:09 sadko4u

And the last, if @jaakkopasanen wants to get similar to Equalizer APO behaviour, there are different options:

  • contribute to the LSP Parametric Equalizer and introduce the compatibility layer;
  • find someone who will introduce the compatibility layer;
  • open a ticket on LSP Github page and get his hopes that once, many-many years after, we'll take on it;
  • become a sponsor of the development of the compatibility layer and compensate all the time spent for the development of the feature.

sadko4u avatar Sep 23 '23 15:09 sadko4u

For reasons that even I do not remember our default is 4.26. I do not remember any special reason for it to be set to this value.

Mode, quality and slope are reset to gsettings defaults.

https://github.com/wwmm/easyeffects/blob/master/src/equalizer_ui.cpp#L549-L567

Digitalone1 avatar Sep 23 '23 15:09 Digitalone1

By the way, I have no invested interest here, just wanted to offer my 2 cents. I'm going to make EasyEffects option in autoeq.app a parametric equalizer with EqualizerAPO file download.

jaakkopasanen avatar Sep 23 '23 16:09 jaakkopasanen