[pulseaudio-discuss] New equalizer module (module-eqpro-sink), some questions

Andrea A andrea69x at hotmail.it
Sun Nov 4 23:23:24 UTC 2018


Thanks for the reply I can try to answer to yours objections

>we need to review the DSP
part, and not just the integration part. It would help if you provide,
in the form of comments in the source code, some references where the
math comes from.

My equalizer is my thesis and math model comes from about 70 pages of calculations. It is not possible to add them as source comments. In my thesis I have inserted and explained only relevant result, and to do only this I've spent about 40 pages.
All math is formally demonstraded so there are not bug in the math model, maybe in implementation at least (but I have done and I will do a lot of tests).
Not to brag but I've to say that I've compared the filtered sound of my equalizer with a lot of others free and commercial sw equalizers and I've not found better, in particular about selectivity of the bands, often equalizers mix the nearest bands, not mine (or at least much less than the other).
If you want I can share my thesis, it's in Italian but I think that a translator can do the rest to make it understandable.

> Also, I think it would make sense to use a struct of 10
well-named floats instead of eqp->c.

Without read the thesis or my calculations it is very hard to understand the role of struct variables, for example "c" are coefficients of the "cut boost" filter, "b" and "a" are standard names for the IIR coefficients, X is the standard name (especially in system theory) for the state, and so on but also if I use more explicative names, from the source, will be hard to understand how it works.

> rewind callback is implemented
incorrectly. The real problem is - nobody implements it correctly

It is true, now I do nothing to manage rewind, but it is not a very bad thing. I had already though to and how manage it correctly, I can revert exactly the filter state "X" storing the buffer. But I think that is not a priority issue and can be performed in future versions.

> The reason is that, by accepting this module, we are implicitly taking
the responsibility to support it inside the tree. And, you are the
best person to support it

Until I die I'm here, I can help you with the math model but how I've write few lines ago the math model is formally demonstrated there are not reason to change it. Yes, it is possible to do some implementation changes, for example I've also a math model that is the same equalizer but parametric that is also interesting, but increase a lot the code complexity and the GUI complexity.

> A better alternative, in my opinion, would be to create a LADSPA
plugin instead

Yes, I can also implement a LADSPA plugin, but PA needs a new equalizer, I've found a lot of discussions about the deprecation of the current equalizer, I tried it and read its source and in my honest opinion it is a very lower level than mine, also for CPU time as well as sound quality.
Me and a lot of GNU/Linux users need a good and professional equalizer solution. My equalizer module is suitable, can be configured to normal desktop user (eg 10 bands) or to professional users, with 32 bands or more and can also respect sound equalizers standard from "american national standards institute".

I don't want to boast but I've worked on the DSP part for a long time and I've read and improved a lot of paper to realize the math model. You can try it if you want, I would like to have your feedback.

Thanks for the time, if you have any other doubts I'm happy to reply.

Andrea993

Il 04 nov 2018 20:14, "Alexander E. Patrakov" <patrakov at gmail.com> ha scritto:

Andrea A <Andrea69x at hotmail.it>:
>
> I'm writing a new equalizer module for PA,
> https://github.com/andrea993/audioeqpro/blob/master/pulsemodule/module-eqpro-sink.c
> I've almost done but I need some information from developer about how to proceed.

Thanks for attempting a contribution. I have attempted to answer your
questions regarding the integration, please read below. However, see
the end of this email for the biggest reason why I am against
accepting this module or any future form of it (but my "no" holds very
little weight, so feel free to ignore it).

However, in order for the module to be accepted (barring the big
objection at the bottom of this email), we need to review the DSP
part, and not just the integration part. It would help if you provide,
in the form of comments in the source code, some references where the
math comes from. And use more descriptive variable names, such as K ->
extra_gain. Also, I think it would make sense to use a struct of 10
well-named floats instead of eqp->c.

> First of all, I see that current equalizer module manages "autoloaded" have I to manage it? What it does exactly? Old equalizer check "autoloaded" state in a callback "may_move_to", what is it? Have I to implement this callback and manage "autoloaded" like the current equalizer module?

It is set by module_filter_apply. The intended effect is to prevent
moving the output of the equalizer to a different sink - i.e. if it
was autoloaded for "Built-in Audio Analog Stereo" then you cannot move
it to "HDMI Digital Stereo" using pavucontrol. See
module-virtual-surround-sink.c for known-good usage. Although, I don't
know any user of module_filter_apply.

Regarding the may_move_to callback, it is called when a user tries to
move the equalizer output to a different sink. Please at least prevent
creating a loop, i.e. moving the output to the equalizer itself.

> After the "autoloaded" management I can send the equalizer as a patch, however I've some questions about how to add my equalizer GUI to the PA branch. Should the GUI remains an external program or the GUI will be inserted to the mainline sources? In the second scenario how the GUI should be inserted? Which is the correct directory in the sources tree and what about the GUI makefile and the GUI installation directory?

PulseAudio currently does not depend on any GUI toolkit (well, except
the old equalizer GUI). Personally, I am fine with this GUI (or maybe
two GUIs - one for GNOME and MATE and XFCE, one for KDE) being in
external repositories.

> The equalizer needs the messages patches from George Chini
> https://patchwork.freedesktop.org/series/41390/
> Have I to write this information as a patch comment or other?

Patch comment.

> I would like to add some configuration files to my module, for example to load and store equalizer preset, is there a PA specific file format (and directory to store file) to do this?

There are database files in ~/.config/pulse. There are multiple
backends supported, see the --with-database=... configure argument.
The abstraction layer is in src/pulsecore/database.h. Not sure if this
is suitable for your needs.

> Execuse me for the wall of questions and thanks in advance.

You are welcome.

Anyway, just a small nitpick: the rewind callback is implemented
incorrectly. The real problem is - nobody implements it correctly,
especially because the comment in the template module-virtual-sink.c
suggest doing such a stupid thing as resetting the filter. And, at
least for the case of a resampler, users other than me do notice the
imperfection, see https://bugs.freedesktop.org/show_bug.cgi?id=50113 .
There are two solutions that I would accept as "proper". 1 - store the
history of your input and/or state, restore it when asked to rewind. 2
- do not pretend to support rewinds (but in this case, please limit
the latency to something like 20-30 ms, so hat PulseAudio reacts
quickly to the new streams). In the name of simplicity, and because
the power-saving argument behind the original rewind operation does
not hold if there is non-trivial processing, I would prefer option 2.

Big warning: I have not tested the module.

And here at the bottom of the email, let me explain why I think
keeping this module outside of PulseAudio, in a different form, may be
a better idea.

The reason is that, by accepting this module, we are implicitly taking
the responsibility to support it inside the tree. And, you are the
best person to support it. So there is an additional (avoidable!)
latency between the time when you develop improvements and the time
when users see them: namely, the time for someone else to understand
and review your code, for PulseAudio team to make a release, and for
distributions to package it.

A better alternative, in my opinion, would be to create a LADSPA
plugin instead. PulseAudio already has module-lasdpa-sink since ages
(even with D-Bus interface to change parameters at runtime), so your
filter will be available also to all users of old PulseAudio versions.
It will be also available to users of pure ALSA-based setup, if they
still exist. You can publish improvements any time you want, without
needing any potentially slow review from PulseAudio maintainers (but
feel free to contact me privately if you do need a review), and your
module will be quick to compile, because it is separated from the rest
of PulseAudio. You can then publish a GUI application that loads the
module into PulseAudio and then controls its filter via D-Bus. And you
don't need to care about rewinds and may_move_to and all other
pulseaudio-specific boilerplate. Sounds like a win-win situation.
Could you please investigate this approach?

Thanks again for attempting to replace the current equalizer with
something better.

--
Alexander E. Patrakov
_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20181104/a7bc5663/attachment-0001.html>


More information about the pulseaudio-discuss mailing list