Skip to content

Equalizer_systemwide_based_on_plugequal_for_mpd

Alvin Schiller edited this page Feb 22, 2024 · 6 revisions

A Systemwide Equalizer based on plugequal for mpd

See original contribution in the issue thread #862

It would be a good thing to be able to do some equalizer Settings for the diversity of Loudspeakers to improve Soundquality

Based on https://wiki.debianforum.de/Erweiterte_ALSA-Funktionen

Installation and setup

Install the required package sudo apt-get install -y libasound2-plugin-equal

Create the Equalizer as ALSA device in /etc/asound.conf In the example below, change "plughw:1,0" according to your hardware setup. You can check available sound cards with aplay -l. If you have disabled the default Rasberry sound output in /boot/config.txt, because you are using a PiHAT audio card, it will most likely be "plughw:0,0".

ctl.equal {
  type equal;
  # The following line is not necessary for me, you will need to try it out
  controls "/home/pi/.alsaequal.bin"
}
pcm.plugequal {
  type equal;
  slave.pcm "plughw:1,0";
  # The following line is not necessary for me, you will need to try it out
  controls "/home/pi/.alsaequal.bin"
}
pcm.equal {
  type plug;
  slave.pcm plugequal;
}

# Make the equalizer the default playback device (optional)
pcm.!default {
  type plug
  slave.pcm plugequal;
}

Change the /etc/mpd.conf to use an ALSA device rather than the sound card hardware directly. Note that mixer_control "PCM" should match your sound card. Type sudo amixer scontrols for a list of available controls.

#
audio_output {
        type            "alsa"
        name            "My ALSA Device"
#       device          "hw:1,0"        # optional
        device          "plug:plugequal"
        mixer_type      "software"      # optional
#       mixer_device    "default"       # optional
        mixer_device    "hw:1,0"
        mixer_control   "PCM"           # optional
#       mixer_index     "0"             # optional
}

mixer_type needs to be set to software in the mpd.conf.

Testing your configuration

  1. Open two terminals. On first terminal enter

speaker-test -c 2 -d plugequal <- This explicitly tests the alsa device "pcm.plugequal" that you created in the asound.conf file

or

speaker-test -c 2 <- This tests the default ALSA device

  1. On second terminal enter

alsamixer -D equal

and play around with the equalizer settings. E.g. set all the lower frequency bands to zero. You should hear the sound change noticeably. Revert your settings and exit (with ESC). Congratulations, step one is complete.

Making it work with MPD

Here comes the magic ingredient: The key insight to making the Equalizer work, is to know that the settings are user-specific. That means you need to make the settings as the user, the audio playback is later started at. Generally, the mpd daemon is not running under the user pi. In the Phoniebox default setup, mpd runs as user root. Check your /etc/mpd.conf for the entry user to see which user mpd runs under.

Testing your configuration with mpd

  1. Open a terminal and enter

sudo -u root alsamixer -D equal

  1. Playback some music by swiping a card. Adjust the equalizer settings in the terminal. With drastic changes in the settings, you should hear noticeable changes. Adjust setting to you liking and exit. The settings are stored and restored automatically.

If you have other music player daemon run under different users on the same Raspbery Pi, you will need to adjust Equalizer settings for each user. This has been tested with Phoniebox Classic, but should transfer easily to Phoniebox Spotify+.

Further information that might help

Audio with my attempt is actually working on Terminal, however I havent figured out to get the general loudness working. However with my basic attempt the loudness is greyed out in the Website...

Hello everyone, I've got it working! See the following Forum for information. https://forum-raspberrypi.de/forum/thread/46718-equalizer-fuer-die-phoniebox/?postID=421069#post421305

Home

πŸ”₯ Version 3

Version 3 Pages

Nothing yet

🎢 Version 2

Version 2 Pages

Installation

Specials

RFID Reader

Sound card configurations

Hardware Buttons

Displays (LED, LCD, Matrix, etc.)

Hacks

Bluetooth

AirPlay

MPD tricks

For Developers

Clone this wiki locally