Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] ALSA & PulseAudio Equaliser #158

Closed
XxAcielxX opened this issue Dec 29, 2022 · 11 comments
Closed

[feature] ALSA & PulseAudio Equaliser #158

XxAcielxX opened this issue Dec 29, 2022 · 11 comments
Assignees
Labels
enhancement New feature or request feature request Request for a new feature

Comments

@XxAcielxX
Copy link
Contributor

XxAcielxX commented Dec 29, 2022

Hello,

As the title suggests, if it is possible to add Equaliser.

Edit 1:
For ALSA with your container I tried this method ALSA-EQ-Plugin and it works perfectly.

Steps to Install

  1. apt update && apt install libasound2-plugin-equal
  2. Create
/root/.asoundrc
...
pcm.!default {
type plug
slave.pcm plugequal;
}
ctl.!default {
type hw card 0
}
ctl.equal {
type equal;
}
pcm.plugequal {
type equal;
slave.pcm "plughw:0,0"; # NOTE this line MUST be your hardware device.
}
pcm.equal {
type plug;
slave.pcm plugequal;
}

In my case, audio is outputting from HDMI.

@GioF71
Copy link
Owner

GioF71 commented Dec 30, 2022

Hello, this is an interesting feature. I will be working on it as soon as I can.
About your asoundrc file, do you use "pcm.plugequal" as the alsa device in the mpd output?

In any case, I will probably start by adding the necessary packages, so by just mounting the asoundrc file and using the 'additional-outputs.txt' file, you will probably not need to do any package operation when the container is recreated. Then I will try to understand how to make this work using environment variable.

@GioF71 GioF71 added enhancement New feature or request feature request Request for a new feature labels Dec 30, 2022
@GioF71 GioF71 self-assigned this Dec 30, 2022
@XxAcielxX
Copy link
Contributor Author

XxAcielxX commented Dec 30, 2022

At first I did create additional-outputs.txt like this:

audio_output {
  type "alsa"
  name "Alsa EQ"
  device "plug:plugequal"
  mixer_type "software"
}

Then I noticed that the EQ was automatically applied to the default output as well.

@XxAcielxX
Copy link
Contributor Author

XxAcielxX commented Dec 30, 2022

I have created /user/config/eq and mounted this volume with my EQ Preset scripts in there. For example:

00-default.sh
...
#!/bin/bash
/usr/bin/amixer -D equal -q set '00. 31 Hz' 66
/usr/bin/amixer -D equal -q set '01. 63 Hz' 66
/usr/bin/amixer -D equal -q set '02. 125 Hz' 66
/usr/bin/amixer -D equal -q set '03. 250 Hz' 66
/usr/bin/amixer -D equal -q set '04. 500 Hz' 66
/usr/bin/amixer -D equal -q set '05. 1 kHz' 66
/usr/bin/amixer -D equal -q set '06. 2 kHz' 66
/usr/bin/amixer -D equal -q set '07. 4 kHz' 66
/usr/bin/amixer -D equal -q set '08. 8 kHz' 66
/usr/bin/amixer -D equal -q set '09. 16 kHz' 66
echo "EQ: reset"

Then I can run docker exec -it mpd /user/config/eq/./<preset>.sh to apply it.

@GioF71
Copy link
Owner

GioF71 commented Dec 30, 2022

That's interesting :-)
There is already an image available, which includes the necessary packages. Can you please try it and see if this works for you? I expect that the manual steps required for adding the package should not be necessary now.

@XxAcielxX
Copy link
Contributor Author

Tested and it is working smooth. 👍🏻

@GioF71
Copy link
Owner

GioF71 commented Dec 30, 2022

Good to hear that.
I will experiment with equalizer myself and probably come out with a release. I can't predict how long this will take though.

@GioF71
Copy link
Owner

GioF71 commented Jan 5, 2023

Hello, I just added support for a new file in /user/config, named asoundrc.txt. I had to also support user mode because the .asoundrc file mounted in /root did not work when using user mode. Can you please verify with the new image? It is building right now.
I am considering creating a asoundrc file from the container, letting the user configure it via env variables, but it seems too complicated to be really useful. Do you agree?
If so, can we close the issue?

@XxAcielxX
Copy link
Contributor Author

Hi,

Tested your new image,

...
    volumes:
      - ${APP_CONF}/mpd/asoundrc.txt:/user/config/asoundrc.txt

And it is working. Creating asoundrc file from the container environments is indeed complicated. I think leaving it the same way as the additional-outputs.txt is best. User can create and mount it as required.

Do leave some kind of documentation guide about it so others can implement the EQ.

Thank you very much for working on my feature request.

Regards,
XxAcielxX

@GioF71
Copy link
Owner

GioF71 commented Jan 5, 2023

Hello, thank you for your feedback. I will add the documentation from this ticket in an additional file in the doc folder and link it in the main README.md.
I will probably do that this saturday. Should you want to send a merge request with part of the documentation, it would be welcome of course. Just feel free to do that if you have some spare time.

@GioF71
Copy link
Owner

GioF71 commented Jan 7, 2023

Thank you for the contribution!

@XxAcielxX
Copy link
Contributor Author

No problem at all. We can now close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature request Request for a new feature
Projects
None yet
Development

No branches or pull requests

2 participants