Pulseeffects: Please add built-in presets

Created on 18 Jun 2018  路  37Comments  路  Source: wwmm/pulseeffects

enhancement help wanted

All 37 comments

I assume you want presets for the equalizer. I am totally in favor but I have no idea about how those generic presets for music genres are done. So someone else will have to do that.

Once someone makes these presets it would also be necessary to think about how to expose them to the user. Considering that now the equalizer can have different number of bands for each preset it does not sound feasible to have a button for each preset in the interface. I think we will have to install these presets files somewhere in /ush/share and point the user to this path when here clicks in the import presets button.

I will leave this issue open in case someone with time and knowledge is interested in providing these presets

If anything is going to be built-in, I also think it makes sense to only include equalizer presets. There's community presets for everything else.

It would be easiest to just strip the presets from a known project. The problem is that whenever I've seen existing presets, they were in proprietary software. But I think this Audacious file list most if not all commonly used presets in many programs: https://gist.github.com/kra3/9781800. Could be that too few bands are included and so this cannot be used, however. Besides those, a must have preset would definitely be the Perfect EQ, as incorporated here e.g. - https://github.com/JackHack96/PulseEffects-Presets.

As for how to implement it, maybe a simple drop-menu in the equalizer settings would work? But maybe this would look bad if there are too many presets.

I think that this list can be big if we offer presets for different numbers of equalizer bands. The ones from Audacious link have 10 but the default in PE is 30 and some people prefer 12 or 15.

But worse than this list size is having the equalizer presets files using a different format than standard PE presets that have all plugins in it. I definitely do not want to increase even more the complexity of PE code base.

Yes, both of these things are an issue. It may be the best to simply have 30 band presets, as is the PE default. But what happens when a 30 band preset is imported and reduced to a say a 10 band one? Would this result in undesired median values applied to new frequencies, ie. would it be different than just directly importing an equivalent 10 band one?

Also, I looked into those Audacious presets and they're actually just ripped from the default Winamp presets. The Winamp equalizer did unfortunately have just 9 bands. But as for the presets' format, of course I didn't mean to say that we should import presets directly, but that it would be useful to already find defined preset names and values. Then they could just be translated into the .json format.

If you import a 30 band preset and then changes the equalizer to have 10 bands you will loose the last 20 bands of the preset. No changes to the frequency and width of the first 10 bands. In other words it does not automatically become a 10 bands graphic equalizer preset. Usually not what people will want. It is the same as opening the preset file and deleting the last 20 bands and updating the num-bands parameter accordingly.

There is no problem in using Winamp presets. Just to clarify let's consider a 2 bands equalizer preset:

"equalizer": {
            "state": "true",
            "num-bands": "2",
            "band0": {
                "gain": "0",
                "frequency": "326.2277660168379",
                "width": "612.45553203367581",
                "type": "peak"
            },
            "band1": {
                "gain": "0",
                "frequency": "10316.227766016837",
                "width": "19367.54446796632",
                "type": "peak"
            }
}

screenshot from 2018-06-19 11-53-04
As long as the number of bands and the parameters for each band are specified in the preset we can use any preset we want. PE will change its interface to match to what is in the preset

If we just install these presets in a place like /usr/share/PulseEffects and then use it as default preset import location we can support presets made for different equalizers easily with no need to complicate the interface. Would this be a problem to the flatpak package @AsavarTzeth ?

As long as /usr is defined by the meson prefix, then no I don't see any problems with this.

Remember with Flatpak /app is the prefix used by apps. /usr is reserved by runtimes.

There may be some minor issues with this approach after all.

  • /app is read-only and hidden to the user outside of PulseEffects. If a user wanted to copy a preset as a base for their own that would be a difficult process.

I may have an extension of your plan.

At build time install presets in <datadir>/PulseEffects. But when a user runs the app also copy those presets to the user presets directory (if they don't already exist). Keep the current default import location.

That way all presets are easy to find in one place, and more importantly reachable outside the PulseEffects container, ex. from a file manager.

Also I recommend prefixing all bundled presets to avoid file naming conflicts. Perhaps use: com.github.wwmm.pulseeffects.preset_name.json

A good location in the git repo migth be contrib/presets. Especially if they are user contributed.

It can be done. But I'd like that only user made presets were visible in the preset menu and that only bundled presets were visible in the import dialog. At least to me it does not make much sense to see presets I have already made as an option to be imported. At this moment any *.json file present in the presets folder is shown in the preset menu. Adding a prefix helps to blacklist bundled presets in the menu. But when the user opens the dialog he will see both bundled and custom presets. It may be confusing. Maybe we could create a folder exclusive to bundled presets inside the presets folder

I am ok with a contrib/presets folder in the repo.

Oh right, sorry but I completly forgot all presets in the user config were added to the menu. I knew it, just forgot it in my haste.

In that case, yes perhaps a sub directory would be a good solution. If the subdir has an obvious enough name a first reaction would probably be to find out what's inside.

No problems. I am thinking about creating a subdir in the user config folder and making the import dialog pointing directly to it. This way it will not show the user custom presets. Nothing will change when populating the menu because the search is not recursive

In any case I will wait for someone to appear here with these community presets before starting any change in this direction.

Feel free to mention here if and when a commit is available for testing.

I've been trying to port the Winamp presets to .json but I want to copy just the equalizer information. The generated .json file contains a lot information and settings I do not want to affect. If I remove everything except the equalizer settings, this file crashes PE. Is it possible to just have the equalizer settings in the .json file?

What is the crash error?

In any case this is a disadvantage of adding these presets this way. PE presets were always meant to save all the parameters as not everybody uses only the equalizer. But it should load the default value of any parameter that is missing in the preset file. It was not supposed to crash in this situation.

Although I still would like that PE did not crash in this situation I think it is better to change a little the approach and show these presets in a list accessed in the equalizer interface. Paste here the json files with only the equalizer presets and I will think about how to integrate them

OK, if I format it differently it doesn't crash but it won't load the equalizer preset.

Debug info just says: (pulseeffects:6698): pulseeffects-DEBUG: 15:51:15.527: presets_manager: loaded preset: /home/filip/.config/PulseEffects/Winamp_Party.json

Here is the file:
Winamp_Party.zip

Also, could I ask you what you think the best way of porting the Preamp feature is? So in all those Winamp/Audacious configs Preamp is set at 0.375 and then all unchanged bands are at 0.375 as well. Since PE doesn't have Preamp, should I just add 0.375 to every value I'm porting?

PE 3.x had input-gain(preamp) and output-gain controls. I could bring them back. It is not a problem. But in PE the units are in decibel so this 0.375 value will become -8.52 (20*log10(0.375)). And the parameter would be called input-gain. So you would have to do this in the presets for example:

"equalizer": {
            "state": "true",
            "num-bands": "10",
            "input-gain":"-8.52",
            "output-gain":"0.0",
            "band0": {
                "gain": "4.875",
                "frequency": "70",
                "width": "46.670000000000002",
                "type": "peak"
            }
}

Wait. Is this 0.375 value already in decibel?

If it is use it and not -8.52

Considering you have a few bands with 0.75 as gain I'd say 0.375 is also in decibel. I am so used to think values smaller than one as being in a linear scale that I assumed it as not in decibel. So just use "input-gain":"0.375" in the presets files

I think so, it should be decibels. I googled a bit and it seems like Winamp did use decibels for EQ changes. Okay, with input gain I can just use the same values as in the sample file.

And also, do you think that the width is properly set? When I generated the frequencies for 10 bands in PE, they didn't match Winamps so I fixed this. But then I also had to change the width. I saw that when PE calculates frequencies for 10 bands, Q was always 1.50. So for the Winamp frequencies I applied a width that also results in Q=1.50.

As far as I remember there are more than one standard for equalizer center frequencies. I don't know exactly which one GStreamer uses. I just looked at its source code and took the equation they use. Winamp presets are probably using other standard. It is not a problem. If you have Winamp presets center frequencies and widths my suggestion is that you just use them. If you change the Q factor or any other parameter the preset will not have the exact effect its author had in mind

That's exactly my concern. I ran Winamp in Wine and took the frequencies from there, I just don't have any information about the widths. I will look into this more first.

Maybe Audacious' source code will reveal something, since their EQ seems like a clone (EDIT: Actually just when you use it with the Winamp skin ) of Winamps.

If you cannot find the width try to find the Q (quality factor). We can reverse engineer the width with it width = center_frequency / Q

It would also be good to know if there is any problem with copyrights

Hmm good point. I will look into this first so that these two issues don't become a headache.

If Audacity is using Winamp presets it should not be a problem to do the same. But it is good to check just in case

Ha, the thing is that even though Audacious copies much from Winamp (if you use the Winamp skin), it actually does not come with any predefined presets. Maybe they did not know how to extract them, but maybe your doubt about copyright is justified. I don't know how that guy obtained the presets, but they definitely need to manually added to Audacious. You can import Winamp's preset format though, but this is not the same as default presets.

I figured out how he likely did it. It's actually fairly trivial even for a non-tech savy user to obtain .preset files of Winamp's default presets. One can simply load each of them in Winamp, save them as .eqf, import as .eqf in Audacious and then save as .preset in Audacious. This may mean they could have been included in Audacious. Since Winamp seems to be abandonware, maybe we can just directly contact the lead dev of Audacious (https://github.com/jlindgren90), he might know something?

It is worth trying. He probably had a reason to not including these presets if Audacious can easily import them

I remembered that GStreamer has presets for their 10 bands equalizer https://github.com/GStreamer/gst-plugins-good/blob/master/gst/equalizer/GstIirEqualizer10Bands.prs. I added them to PE
screenshot from 2018-06-22 14-27-18

@AsavarTzeth I realized that there was a better approach that should work for everyone. Embedding the presets files in the executable binary using gresource. I already do that with the glade files and a few custom icons used in PE interface. So I see no reason for flatpak to have problems with these presets.

I updated the master branch with these changes. Presets files can be seen in the presets folder https://github.com/wwmm/pulseeffects/tree/master/data/presets. As I reorganized a littl the data folder there are small differences when running directly from the sources https://github.com/wwmm/pulseeffects/wiki/Run-Directly-from-Repository.

Vlc has presets but they look the same as the ones from GStreamer.

Awesome! What do you think about maybe integrating Perfect EQ as well, e.g. as here: https://github.com/JackHack96/PulseEffects-Presets/blob/master/Bass%20Enhancing%20%2B%20Perfect%20EQ.json . It's also 10 band and IMO one of the best presets you can find.

And also if @JackHack96 would be okay with it, of course.

As long as he is okay with it I see no problems

Excuse me I didn't receive any notification (I must check GitHub settings).

Anyway there's no problem with integrating ;)

I only have a question though: is there something like preamp in the equalizer?
Because it sometimes causes clipping, and I should lower the master channel for preventing it.

Also, I updated the wiki page about community presets, as it seems I'm the only one who updated the presets to the JSON format. I'm planning to convert more presets to JSON in my free time, and I'll upload them in my repo :)

Hi! In the latest PE release the equalizer has input (preamp) and output gain controls.

Do you have any suggestion about how to name your preset? Considering that we can have presets from anywhere with any number of bands I decided to name GStreamer's presets like gstreamer_pop instead of just pop for example. In other words the idea would be to have the source of the presets followed by an underline and then the preset name.

Ok, I'll wait for the flatpak update from @AsavarTzeth then ;)

As for the name, uhm, I'm not very good at naming (like all programmers xD).
I made the presets based on the link you can find in my repo, so we could call it something like zihad_perfecteq or simply perfect_eq :)

Was this page helpful?
0 / 5 - 0 ratings