Summary: one way to adjust Debian Linux audio output volume by frequency to compensate for differential hearing loss across the spectrum, which is better than simply cranking up audio output volume.

So, I happen to be hearing impaired; one of the problematic things about hearing impairments is that hearing loss is not uniform across frequencies - for example, as people get older they tend to lose more of the higher frequencies ( ) which is why 'teenager repellents' work since they whine at a pitch too high for hearing-damaged post-teenagers to hear.

This has the practical consequence that to fix hearing loss, it's not enough to just 'turn the volume up to 11', since in order to bring the worst frequencies up to par you will simultaneously overcompensate & make the other frequencies far too loud. Indiscriminate amplification is better than nothing and so of course people used analogue hearing aids, but still imperfect. Modern hearing aids are digital and programmable, and can vary amplification by frequency based on one's audiogram ( ) results showing one's personal loss curve (an example in ).

Mine are adjusted and while I dislike some of the downsides of modern digital hearing aids (a 1-2 second boot-up, compared to the instant-on of analogues; shorter battery life), adjusted ranges are definitely better.

I much prefer to listen to music on my headphones in order to avoid bothering other people, hearing background noise, using up batteries (see above about battery life), and so on. But dialing up the volume to compensate for hearing loss puts me right back where I started with my analogue hearing aids! It's good, but it could be better.

How? I've never seen any default audio interface on Windows or Linux include per-frequency volume adjustment. You can usually change the total volume balance of the left/right channels for the headphones (in my case, I bias towards the left a bit since there's more hearing loss there), but not by frequency. I didn't know where to go for such an 'equalizer'. (Amusing term in this context.)

I've put up with this for years but last night went looking for a Linux solution. I wandered through an awful lot of dead ends and terrifying looks at the bizarre innards of Linux audio over the last 3 decades (an abandoned Pulseaudio mixer, LADSPA, LX2, Audacity, alsamixer, alsamixer-gui, fil-plugins, swh-plugins, libasound2-plugin-equal, veromix...), but finally I think I found a solution:

a new Pulseaudio equalizer named 'qpaeq' which unaccountably seems to not be packaged by Debian (‽), but which following the guide can be installed roughly like this:

    sudo apt-get install python-dbus python-qt4 python-qt4-dbus pulseaudio-utils
    wget -O /tmp/qpaeq; sudo install /tmp/qpaeq /usr/local/bin/
    pulseaudio -k; pulseaudio & pactl load-module module-equalizer-sink; pactl load-module module-dbus-protocol
    sudoedit /etc/pulse/

then edit into that file:

    ### Load the integrated pulseaudio equalizer and dbus modules
    load-module module-equalizer-sink
    load-module module-dbus-protocol

(Why not edit `~/.pulse/`? Apparently the Pulseaudio daemon will read either the system xor the user's, and never both, so I'd rather re-edit the global file everytime I reinstall Linux than have to keep a local one in sync with the arcane permutations of Pulseaudio.)

Then in the GNOME/MATE volume control, one switches the 'Output' tab to the new 'FFT...' device to enable modification, and runs 'qpaeq' to start doing the tweaking. As the guide suggests, playing music and messing with the overall volume helps confirm that it's all set up correctly.

Finally, one can start compensating for the hearing loss curve. qpaeq and my audiogram aren't on the same scale (the equalizer runs to much higher frequencies than the audiogram, which cuts off at 8khz) and bucket things differently, but that's nothing a bunch of tweaking and back-and-forthing won't fix.

The tweaks made, the state gets saved to ~/.pulse/equalizer-state.tdb, where hopefully it then is persistent and affects audio output for as long as the FFT output device is chosen.

And voila: hearing loss compensation in 10 easy steps!

(How well does it work? It's a bit soon to tell since it's relatively subtle even sitting in an audiologist's office tweaking the settings, but music seems less tiring and distracting with both the left-right tweaks and the frequency tweaks turned on.)

EDIT: this guide appears to still be valid as of 6 October 2017 on my Lenovo Thinkpad P70 running Ubuntu 16.04.3 LTS / Mate 1.12.1 / Xmonad 0.12.

#hearingloss #hearingaids #equalizer #debian #mate