bmc0 / dsp

An audio processing program with an interactive mode.
ISC License
222 stars 31 forks source link

How can I swap EQ profiles on Ubuntu 16.04 when I plug in a different pair of headphones? #14

Closed RobotMav closed 7 years ago

RobotMav commented 7 years ago

Sorry if this isn't the right place to post. The wiki doesn't really say how I can switch between EQ/no EQ depending what's plugged into the output device. Thanks

bmc0 commented 7 years ago

This would be more of an ALSA/PulseAudio configuration issue. LADSPA plugins know nothing about input/output devices.

I don't know of an easy way to configure this to happen automatically. If you're using PulseAudio, you could write a script that listens for events (via pactl subscribe) and then executes the appropriate pacmd commands to switch sinks.

RobotMav commented 7 years ago

I'm not exactly interested in doing it automatically because that would be impossible with my setup. I have a USB dac I want to output to so there is no way for the computer to detect whether the headphone is plugged in. I want to know how I can manually turn off EQ when I use my earbuds with the dac.

bmc0 commented 7 years ago

One way to turn the EQ off is to just change the default sink to the actual output device instead of the LADSPA plugin. This can be done using pavucontrol (hit the check button with the "Set as fallback" tooltip under the "Output Devices" tab) or pacmd set-default-sink <sink_name>. You can also set the sink for each active client in the "Playback" tab or by using the pacmd move-sink-input command. To re-enable the EQ, you just need to change the default sink back to the LADSPA plugin.

If you also want to switch all active clients, have a look at this Ask Ubuntu post (linked in the wiki page).

Another way of doing this is to just comment out the effects_chain line in the ladspa_dsp configuration file. This change won't take effect until the module is reloaded though (usually by restarting the PulseAudio server).

If you want to toggle between two different EQ profiles, you can create two configuration files in the ladspa_dsp configuration directory called, say, config_headphones and config_speakers. This will allow you to choose which configuration you want to use by selecting either the ladspa_dsp:headphones or ladspa_dsp:speakers label. See the README. You can load them both like this:

load-module module-ladspa-sink sink_name=dsp_headphones master=<sinkname> plugin=ladspa_dsp label=ladspa_dsp:headphones
load-module module-ladspa-sink sink_name=dsp_speakers master=<sinkname> plugin=ladspa_dsp label=ladspa_dsp:speakers

Then you can switch between the two sinks as described in the first two paragraphs of this post.

RobotMav commented 7 years ago

Thanks. I'll try this out soon and let you know how it goes.