2

I have migrated to Ubuntu from Windows recently. It has been a great experience. But, one thing annoyed me the most and that is the headphones noise issue. It is a very common problem and I have almost gone through every question asked about this issue on the forum. I am using Ubuntu 16.04.1 on my DELL INSPIRON 15 3542 touchscreen laptop.

I have tried :

  • alsamixer and disabling the Loopback Mixing
  • Adding 0 in the /sys/module/snd_hda_intel/parameters/power_save file

  • INTEL_AUDIO_POWERSAVE=false in /usr/lib/pm-utils/power.d/intel-audio-powersave

Nothing worked, not even temporarily.


Now, what I have observed is whenever I open the PulseAudio Volume Controller and keep it open, the noise is gone! As soon as the application is closed, the noise comes back. So, this seems to work temporarily and a cheap solution. Can anyone look into this matter and come up with a permanent solution for the issue?

2 Answers 2

1

A lot of users are facing noise problem when headphones are connected and are fed up with it just like I am. This solution is for them. There are a lot of solutions given on askubuntu but none have worked for me.

Things were good when I used Windows 8.1. There was no such sound issue. Well, but now I am on Ubuntu and I have no plans of going back to Windows.

I have accepted the fact that my laptop's sound system is not shielded properly. I haven't addressed the root of the problem, but just kind of made it a virtually unnoticable.

So, the hack is quite simple. As the problem persists only when there is no playback, I came up with a hack to always have a playback! Now, this should be true only when the headphones are connected. And the playback should stop when headphones are removed.

Follow these simple steps-

Step #1: Install mplayer and configure it.

sudo apt install mplayer    
nano ~/.mplayer/config  

type in that file-> lirc=no

Step #2: Download this mp3 file from here (silence-10sec.mp3)

Step #3: Create a folder in home directory and name it .hush
Copy the mp3 file in your .hush directory

cp ~/Downloads/silence-10sec.mp3 ~/.hush/

In that folder, create a script file and name it silence.sh
Copy paste this code in the script file.

#!/bin/bash

plugged="jack/headphone HEADPHONE plug"
unplugged="jack/headphone HEADPHONE unplug"

acpi_listen | while IFS= read -r event;
do
    if [ "$event" == "$plugged" ]
    then
       mplayer -really-quiet -loop 0 ~/.scripts/silence-10sec.mp3 &
    elif [ "$event" == "$unplugged" ]
    then
       pkill -f mplayer
    fi
done

Make it executable with the command chmod +755 silence.sh

Step #4: Type startup applications in the Dash and add the path of silence.sh script to it.

enter image description here

So, basically what we are doing is listening to events of headphones been connected and disconnected and playing or stopping the blank mp3 file in a loop. Now, I have used mplayer because I know that I am never gonna use that for any other purpose and killing its process is completely safe for me.

I came up with this idea when Serg answered to one of my questions.
He came up with this script and I just made modifications to it to suite the requirement.

0

I like and had to use this approach as I couldn't correct the problem even with these root changes made to terminate the power save of the headphones. One change I made though was to install the sox pagae to use the play feature and also mp3 support:

$ sudo apt install sox # contains 'play' to play audio $ sudo apt install libsox-fmt-all # to enable mp3 support

#!/bin/bash

plugged="jack/headphone HEADPHONE plug"
unplugged="jack/headphone HEADPHONE unplug"

acpi_listen | while IFS= read -r event;
do
    if [ "$event" == "$plugged" ]
    then
       play -loop 0 /home/$USER/.hush/10-seconds-of-silence.mp3 &
    elif [ "$event" == "$unplugged" ]
    then
       pkill -f play
    fi
done

Note try opening the following and changing 1 to 0:

$ sudo nano cat /sys/module/snd_hda_intel/parameters/power_save

This did work for me but had trouble even as root overwriting the file likely as it is being updated as it's being used (not 100% on that) I brute forced it and once replaced, headphones became silent.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.