Friday, April 19, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 4237  / 3 Years ago, fri, june 4, 2021, 4:10:42

The facts below come from experience with Ubuntu 13.10 on a 64-bit laptop.



Context/problem: bad speakers



As many people know, laptop speakers have "highly unequal frequency response" as audio professional would say. Normal people say: "they sound very bad".



First-step solution: equalization



Equalizing provides a valuable workaround, dramatically improving sound quality with a one-time effort. For example, I installed PulseAudio Equalizer from Web Upd8.



For good results, equalization values should be chosen based on measurements, but that's another story (I could do it with Ubuntu alone though it's tricky, ask me for details).



Remaining problem: equalization curve is output-dependent



Equalization values are attached to the whole chain, though generally only the speakers are a major source of unequal response.



This means I have two equalization profiles:




  • one for laptop speakers (with wildly varying equalization curve)

  • another (much flatter curve, so disabling equalization is often acceptable) when an external stereo is plugged to e.g. a 3.5mm jack.



Current situation in practice: auto un/mute, good but insufficient




  • When plugging the 3.5mm jack to the external stereo, internal speakers are automatically muted and volume adjusted by the Ubuntu stack. This is good but insufficient.

  • When unplugging, internal speakers are automatically activated again. This is good but insufficient.



Improvement: not only auto-mute but auto-select eq curve



It would be much better to have the correct equalizer preset applied when un/plugging the 3.5mm jack. Plug the external stereo, the flat curve is selected. Unplug the stereo, internal speaker get their correction curve.






Questions



How to make a quick-and-dirty hack ? How to detect jack plug from a script ?





How to make a clean setup: assign the equalization curve to internal speaker, not just plug event.



For example, say I plug a USB audio device and play audio through it. The quick-and-dirty hack would change EQ curve whenever the 3.5mm jack is un/plugged, though the audio actually continued to go to the USB audio device not the internal speaker, making eq curve change irrelevant.



In a "clean" setup, an equalization profile would be cleanly assigned to the internal speaker, making the thing more robust. Whatever the situation, it would be always (and only) applied when needed.



Is anyone working on it ? Any hint ?



Thank you for your attention.


More From » pulseaudio

 Answers
7

Because I have a similar problem i have made a "quick and dirty" python script which uses pulseaudio's DBus-Events to detect when to activate which equalizer profile.



Installation



To use it you have to add the following line to /etc/pulse/default.pa:



load-module module-dbus-protocol


Then disable the equalizer via pulseaudio-equalizer-gtk and click on "Apply settings", now close the GUI.



Download apply-equalizer.py save it somewhere and make it executable.



Execute it as user (!). Maybe you need to install some additional python modules. Also you may want to automatically start it on login (i dont know what is the best way to do that).



Usage



The script creates per-port [1] equalizer-configurations under ~/.config/apply-equalizer and symlinks them if a device changes the output port (i.e. headphones plugged in or out).



[1]: many sound cards have different ports, e.g. one speaker-port and one headphone-port



So:




  1. Unplug headphones.

  2. Open pulseaudio-equalizer GUI

  3. Customize equalizer-settings until it sounds good

  4. "Apply Settings" will then assign the configuration you made (including if the equalizer is enabled at all) to the current port (speakers in this case)

  5. close the GUI and repeat from step 2 for every port you want to assign (headphones not plugged in)



Now the equalizer settings get automatically adjusted whenever your switch between speakers and headphones.


[#27591] Saturday, June 5, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
biryanrownies

Total Points: 396
Total Questions: 90
Total Answers: 106

Location: Saint Lucia
Member since Sun, Sep 5, 2021
3 Years ago
biryanrownies questions
Wed, Sep 7, 22, 18:13, 2 Years ago
Fri, Dec 3, 21, 02:50, 2 Years ago
Sat, Feb 12, 22, 16:02, 2 Years ago
Sat, Apr 15, 23, 09:22, 1 Year ago
;