Ubuntu – Stop sound from speakers when connecting headphones

headphoneslaptoppulseaudiosoundspeakers

I guess this question already had the answer here but I can't find it. I'm using 12.04.

Update:

The problem is that I can hear the sound from my laptop's speakers even if I plugged in my headphones. Headphones is just standard stereo headphones. And the most interesting thing is that all was working just a week ago.

I tried to play with pulseaudio and alsamixer settings – no results.

Best Answer

Original Solution

  1. Go to Realtek official site, accept the disclaimer, then download the audio driver for linux/unix. You need to select version 3 for Kernel 3 or later.

  2. Setup necessary tools to compile this driver.

    sudo apt-get install build-essential gcc make

  3. Extract the downloaded file, run sudo ./install file from a terminal after going to the extracted folder to compile the driver.

  4. Read the Readme.txt file for more information.

  5. Install gnome-alsamixer by this command.

     sudo apt-get install gnome-alsamixer
    
  6. Open the gnome-alsamixer by typing alsamixer in the dash.

  7. Select the "Auto mute mode" in the new window.

Reboot and see whether it fixed now. (Step 6 and 7 might not necessary). Automute will automatically enabled upon restart


Solution 2:

I have just found another solution:

(It worked for me with Only S/PDIF profile, Sound from both headphone and speaker and not being able to switch profile)

  1. Add this ppa by the command

      sudo apt-add-repository ppa:ubuntu-audio-dev/alsa-daily
    
  2. Update packages list. by

     sudo apt-get update
    
  3. Then install "alsa-hda-dkms" package:

      sudo apt-get install alsa-hda-dkms
    

Reboot, And See the result!