Ubuntu – Headphones and Speakers are not detected separately in [Ubuntu 18.04]

18.04sound

I'm very new to Ubuntu, but decided to give a go, over my current Windows 10 installation. And everything is running just find, except for the sound.

The issue:
– The system doesn't seem to recognize my headphone and speakers as two separate devices, even though they ARE plugged in to their own respective jack input. (This was not an issue on windows). I have a jack input in the top front on my cabinet, and the direct input on the back (the sound card, which is build in).What I've tried:

  • Rebooting.
  • Unplugging the jack's.
  • Adjusting the volume, also in Alsamixer.
  • Restarting Alsamixer.
  • Add Semilated device with paprefs
  • Reinstalling Alsa and Pulseaudio

Additionally:

At the moment, I have only my headphones plugged in, but it seems as whenever I have them both plugged in (which is the use-case I'm going for) alsa automatically mute my headphones.

Also, as far as I can see the system sound settings, only ONE analog input is recognized, and ONE digital (I do not use the digital input).
So, my guess would be that both my analog ports (physically) are recognized as the same thing, not sure how to resolve this though.

Screenshots:

Alsamixer

Sound Settings

Hardware info:

PCI and USB

Input Devices

DMI

I really hope you might be able to help me out! I very much appreciate any help given!

Please let me know if I have left out any important information!

EDIT:

As per the suggestion of @Qumber Rizvi I tried installing Pavucontrol. This didn't solve the issue, but heres what I learned:

In Pavucontrol I can change between two different outputs ("Line Out" and "Headphones") under the "Analog Build-in Analog Output". If I choose "Line out" it is just my speakers playing. If I choose "Headphones", both my speakers and my headphones are playing?

Screenshot of Pavucontrol

Best Answer

Both my speakers and my headphones were playing sound at the same time and I just fixed that issue using the answers by WinEunuuchs2Unix and notorious.dds. You may want to read those posts for more complete info.

The below instruction will separate Line Out and Headphones (mine is actually a headset with mic) in the Ubuntu 18.04 Sound Settings (Volume Settings). You can swap the output device using by clicking on it in Sound Settings and individually set the volume for each.

Ubuntu 18.04 Sound Settings

Note that this fix may be overridden by pulseaudio software updates, in which case you may have to repeat the process below.

Determine your ALSA output file

  1. Disconnect your headphones and select your speakers as the output in Sound Settings.

  2. Open a terminal (Ctrl+Alt+T) and type pactl list | grep 'Active Port.*output.*'. Note the active port. Mine was analog-output-lineout so I will use analog-output-lineout.conf as my ALSA speaker output file in the below instructions.

  3. Connect your headphones and select them as the output in Sound Settings.

  4. Type pactl list | grep 'Active Port.*output.*' again and note the active port. Mine was analog-output-headphones so I will use analog-output-headphones.conf as my ALSA microphone output file the below instructions.


Edit ALSA output file for the speakers

  1. Change to ALSA mixer path files directory by typing cd /usr/share/pulseaudio/alsa-mixer/paths/

  2. Backup the speaker output file by typing sudo cp ./analog-output-lineout.conf analog-output-lineout.conf.bak

  3. Edit that file by typing gedit admin:///usr/share/pulseaudio/alsa-mixer/paths/analog-output-lineout.conf

  4. Find the [Jack Headphone] or [Jack Front Headphone] line, depending on where your headphone jack is located and it should look something like this:

    [Jack Headphone]
    state.plugged = no
    state.unplugged = unknown
    
  5. Change state.plugged = no to state.plugged = yes to tell pulseaudio that headphones are always plugged in.

  6. Add this to code to the end of the file (but before any .include lines) to create a volume slider for the speakers. Then save and close the editor afterwards.

    [Element Line Out]
    switch = mute
    volume = merge
    

Edit ALSA output file for the headphones

  1. Backup the Headphone output file by typing sudo cp ./analog-output-headphones.conf analog-output-headphones.conf.bak

  2. Edit that file by typing gedit admin:///usr/share/pulseaudio/alsa-mixer/paths/analog-output-headphones.conf

  3. Add this to code to the end of the file (but before any .include lines) to mute the speakers when headphones are selected. Then save and close the editor afterwards.

    [Element Line Out]
    switch = off
    volume = off
    
  4. Skip this step on the first try and complete the steps below. If the speaker sound does not turn off when the headphones are selected, it may be because the sound is being redirected through the Front element. Find the [Element Front] line and modify it as this:

    [Element Front]
    switch = off
    volume = off
    

Edit Auto-Mute is disabled in alsamixer

  1. Type alsamixer
  2. If needed, use F6 to find the correct soundcard for the speakers.
  3. Using the arrow keys to find Auto-Mute and disabled ysing the down-arrow
  4. Press Esc to close alsamixer and
  5. Save changes with alsactl store

Restart Pulseaudit

  1. Type pulseaudio -k && pulseaudio --start

You should now see separate options for speakers and headphones in sound settings.