An equaliser that works with MPD and ALSA

A few months ago I was looking for a way to lower the amplification of the lower frequencies while listening to music on extremely bass-heavy in-ear headphones. The only way to accomplish that, seemed to be using JACK. Since that seemed overkill to me, I gave up.

Today I found a solution that does not require JACK: Charles Eidsness’ ALSAEQUAL. This is how you get it working with MPD on Gentoo:

  1. `emerge alsaequal`
  2. Create an .asoundrc file in the home directory of the user that runs MPD on your system (see `grep "^user" /etc/mpd.conf`) with the following content:

    ctl.equal {
      type equal;
    }
    
    pcm.plugequal {
      type equal;
      slave.pcm "plug:dmix";
    }
    
    pcm.equal {
      # Or if you want the equalizer to be your
      # default soundcard uncomment the following
      # line and comment the above line.
    # pcm.!default {
      type plug;
      slave.pcm plugequal;
    }
    

    (copied from the ALSAEQUAL website – modified so that dmix is being used, which allows playing multiple audio sources simultaneously)

  3. Find the audio_output section in your /etc/mpd.conf where you currently configure MPD to use ALSA’s default device. Change it so that it looks like
    audio_output {
      type    "alsa"
      name    "equal"
      device  "plug:plugequal"
    }
    
  4. `/etc/init.d/alsasound restart && /etc/init.d/mpd restart`
  5. Play a track with MPD, then run `alsamixer -D equal`*. Modify any of the frequency band sliders and observe the effect.

Other applications will be unaffected by the equaliser, if you don’t change the .asoundrc according to the comment, and if you don’t configure them to use the ‘equal’ ALSA device.

*) Note that alsamixer needs to be run as the user that runs mpd. See Ian’s comment for details.

Update (2012-06-16): Having the .asoundrc in place causes Skype to crash after a few seconds (see also this Gentoo Forums post).

19 Responses to “An equaliser that works with MPD and ALSA”


  • Thank for this great tutorial.
    I have been looking for an equalizer that works with MPD (+NCMPCPP) as my netbook speakers are somewhat crappy and ‘tinny’.
    alsaequal is working wonders so far.

    JD

  • Great thanks for this info. Works great in Arch Linux.
    Lack of equalizer was the only thing that stopped from switching to MPD from XMMS2.

  • Unfortunately this seems to not work for phonon because phonon does not show up the equalizer device (plug).

    Even if I select to show “extended device list” there is no sound sink for the equalizer. Even worse: The card used by plugequal also disappears in phonon.

    Kmix and alsamixer also do not show the equalizer – but it is possible to use it in alsamixerby entering the name manually.
    Playback with alsaplayer -d equal also works fine for me, with the equalizer in effect.

  • Step 3 (mpd configuration) doesn’t work for me. What mpd version do you use, and which configure switches?

    • Hi Jakob,

      I’m using version 0.15.5 with Gentoo USE flags “aac alsa bzip2 curl ffmpeg fifo flac id3 lame mad mikmod musepack network ogg sqlite unicode vorbis”, which means

      ./configure –prefix=/usr –build=x86_64-pc-linux-gnu –host=x86_64-pc-linux-gnu –mandir=/usr/share/man –infodir=/usr/share/info –datadir=/usr/share –sysconfdir=/etc –localstatedir=/var/lib –libdir=/usr/lib64 –disable-ipv6 –disable-cue –enable-sqlite –enable-curl –disable-lastfm –disable-mms –enable-bzip2 –disable-zip –disable-iso9660 –enable-id3 –disable-audiofile –enable-ffmpeg –enable-flac –enable-mad –enable-mikmod –disable-modplug –enable-mpc –enable-vorbis –disable-sidplay –disable-fluidsynth –disable-wavpack –disable-lsr –enable-alsa –disable-ao –enable-fifo –disable-pipe-output –disable-jack –disable-oss –disable-pulse –enable-aac –disable-debug –disable-gprof –without-zeroconf –enable-tcp –enable-un –disable-wildmidi –disable-libOggFLACtest –disable-documentation –enable-shout –enable-vorbis-encoder –enable-httpd-output –enable-lame-encoder –enable-oggflac

      • I didn’t consider that alsaequal stores its settings per-user. It’s running perfectly now, thanks for your accurate guide.

        • This is actually quite important, because many people will probably just try to run alsamixer as either themselves or as root, and that won’t do anything in the normal mpd setup where mpd runs as a separate mpd user; so they’ll give up. So I thought I’d comment here how to make it work. You have to run alsamixer like this:

          su -s /bin/sh -c ‘alsamixer -D equal’ mpd

          or similarly with sudo:

          sudo -H -u mpd alsamixer -D equal

          this is a fingerfull, so make a shell alias for it.

          • Thanks for that note, Ian. I didn’t consider it, because on my system I run mpd as my main user. I added a note to the blog post.

          • Very helpfull. I’m happy that I’ve read your comment after a hour of trying to make alsaequal work with dmix and MPD using own softvol pcm device. After reading your comment I had to facepalm because of the reason I spent so much time without success 😉

  • By the way, I have since found that you *really* need different eq settings for different types of music. Listening to Sandy Denny sing “Reynardine” and “Tam Lin” I lifted the high-midrange (around 500 Hz) and the top 2 bands to let her voice and articulation stand out against the bass and drums. Then I played Bach Brandenburg Concertos with these settings and the viola sounded like the odd Chinese 1 string instrument 😮 I’m only exaggerating a little. So, I need to switch settings; but changing all these sliders every time is tedious, so I have written a couple of scripts to semi-automate it. I can contribute them if you tell me where to put them.

    • Sounds interesting! I can host them here if you want – just upload them.
      If you intend on working on these scripts later, maybe you could just put them on one of the public code hosters (github, for example), and post a link here!

  • I decided to put them on github because I in fact have plans to improve them, even though in the current state they’re probably not usable by anyone else.

    https://github.com/nobrowser/alsaequal-scripties

  • Thank you!

    Absolutely love how this turned out.

    I started installing Gentoo yesterday morning, and just got Xorg and ALSA working earlier this afternoon.

    I had heard about mpd awhile ago, and always wanted to try it. For whatever reason it and alsaequal seem to be easier to configure on Gentoo somehow..

    Is installing and configuring Gentoo supposed to make you feel like a badass?

    http://imagebin.org/index.php?mode=image&id=162860

    • Congratulations on your new Gentoo system :) If you got that far, you’ll probably enjoy Gentoo, and stay with it.

      I don’t know, it didn’t really make me feel like a badass, but maybe it should have 😉 Anyway, have fun!

    • > Is installing and configuring Gentoo supposed to make you feel like a badass?
      YeAH!!! definite C:
      for what it’s worth, i had the right settings put up since some time (systemwide, in /etc/asound.conf) but only this article’s lil footnote put me on the right track… it’s
      sudo -u mpd alsamixer -D equal
      nice stuff, finally a nice curses equalizer – now how to integrate it with ncmpcpp _mmmhhh__

  • What is MPD? you didn’t explain what MPD is.
    what does “emerge alsaequal” mean? I don’t understand

    does this work in ubuntu?

    I’m confused.

    • Hi dave,

      MPD (music player daemon) is a music player for Linux, which works as a daemon or service. It does not have a frontend / graphical user interface on its own, but it can be connected to through the network, by any compatible client. Follow the link to learn more.

      `emerge alsaequal` is the command needed when using Gentoo Linux, to install the package ‘alsaequal’. See Gentoo Linux’s Wikipedia page to get more info about the Linux distribution.

  • I had to logout/login out of my desktop in order for my .asoundrc to be reloaded. Works brilliant!

  • Hi,
    I ran alsamixer -D equal and got the following error.
    ALSA lib ctl_equal.c:268:(_snd_ctl_equal_open) Problem with control file .alsaequal.bin, 3.
    cannot open mixer: Operation not permitted

    Any help would be appreciated.
    Thanks!

Leave a Reply