• Switch audio to headphones automatically


    I can either play audio throuhg laptop speakers or headphones (audio jack) but I have to change the device manually. Is there any way to do it automatically when headphones are plugged in?

    Also how come does my PulseAudio show Headphones(unplugged) when obviously plugged and audio works?

    Somewhat newbie, atleast with Antergos and arc, please be gentle.

  • I think your real problem is the second one. When I plug my headphones in, my system always asks me what to do.

    Can you provide info about your hardware (lspci output should be enough) and do you know which kernel are you using?

  • @psscnp142
    Oh and just in case, on Windows it switching works perfectly fine.
    I’m not sure if this is what you’re after but:

    4.11.7-1-ARCH #1 SMP PREEMPT Sat Jun 24 09:07:09 CEST 2017 x86_64 GNU/Linux
    
    00:00.0 Host bridge: Intel Corporation Skylake Host Bridge/DRAM Registers (rev 08)
    00:02.0 VGA compatible controller: Intel Corporation HD Graphics 520 (rev 07)
    00:04.0 Signal processing controller: Intel Corporation Skylake Processor Thermal Subsystem (rev 08)
    00:14.0 USB controller: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller (rev 21)
    00:14.2 Signal processing controller: Intel Corporation Sunrise Point-LP Thermal subsystem (rev 21)
    00:15.0 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO I2C Controller #0 (rev 21)
    00:15.1 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO I2C Controller #1 (rev 21)
    00:16.0 Communication controller: Intel Corporation Sunrise Point-LP CSME HECI #1 (rev 21)
    00:17.0 SATA controller: Intel Corporation Sunrise Point-LP SATA Controller [AHCI mode] (rev 21)
    00:1c.0 PCI bridge: Intel Corporation Device 9d10 (rev f1)
    00:1c.4 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #5 (rev f1)
    00:1c.5 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #6 (rev f1)
    00:1f.0 ISA bridge: Intel Corporation Sunrise Point-LP LPC Controller (rev 21)
    00:1f.2 Memory controller: Intel Corporation Sunrise Point-LP PMC (rev 21)
    00:1f.3 Audio device: Intel Corporation Sunrise Point-LP HD Audio (rev 21)
    00:1f.4 SMBus: Intel Corporation Sunrise Point-LP SMBus (rev 21)
    02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 10)
    03:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8723BE PCIe Wireless Network Adapter
    
  • Still looking for solution

  • I wish I could help, but I don’t have any experience on this:disappointed:. Hopefully someone who does shows up soon!

    Keep trying, never give up. In the end, you will find that it was all worth it

    Community ISO: https://antergoscommunityeditions.wordpress.com
    Linux Basics: https://linuxbasicssite.wordpress.com

  • @Irto First thing you should try is:
    alsamixer press [F6] to choose your sounddevice and take a look to what it shows up.

    [updates once a week] = [90% less problems]
    http://gofccyourself.com
    howto-install-antergos
    how to add system logs
    i3 GNOME

  • @Irto Next: give us the status of pulseaudio:
    pacmd list-sinks | curl -F [email protected] https://ptpb.pw/?u=1

    [updates once a week] = [90% less problems]
    http://gofccyourself.com
    howto-install-antergos
    how to add system logs
    i3 GNOME

  • 0_1500318625303_Bildschirmfoto vom 2017-07-17 21-10-12.png

    :::edit: clean up unclear / funny %

    [updates once a week] = [90% less problems]
    http://gofccyourself.com
    howto-install-antergos
    how to add system logs
    i3 GNOME

  • it looks like this if you plug and unplug headphone?
    mute/unmute alsamixer video

    as you can see from pacmd list-sinks

    ports:
    analog-output-speaker: Speakers (priority 10000, latency offset 0 usec, available: unknown)
    
    analog-output-headphones: Headphones (priority 9000, latency offset 0 usec, available: no)
    
    active port: <analog-output-speaker>
    

    strange here is that instead of available: yes analog-output-speaker is listed as available: unknown
    So i believe you that there is something wrong.
    Can you check if when analog-output-speaker is unpluged alsamixer mute the channel (Speaker) or may Headphone get muted… or nothing happens…

    [updates once a week] = [90% less problems]
    http://gofccyourself.com
    howto-install-antergos
    how to add system logs
    i3 GNOME

  • pavucontrol in GTK DEs, pavucontrol-qt in QT DEs.

    regards

  • @c00ter said in Switch audio to headphones automatically:

    pavucontrol in GTK DEs, pavucontrol-qt in QT DEs.

    What do you mean related to the topic?
    Where i can change the autochanging of output devices inside pavucontrol ?

    [updates once a week] = [90% less problems]
    http://gofccyourself.com
    howto-install-antergos
    how to add system logs
    i3 GNOME

  • Aack! I meant paprefs in GTK DEs. It’s a checkbox “Add virtual output device…”

    In KDE, it is also a checkbox in System Settings>Multimedia.

    I typically install pavucontrol & paprefs in GTK, pavucontrol-qt in KDE.

    regards

  • @Irto said in Switch audio to headphones automatically:

    Still looking for solution

    ???

    Do you have alsa-firmware installed?

    [updates once a week] = [90% less problems]
    http://gofccyourself.com
    howto-install-antergos
    how to add system logs
    i3 GNOME

  • Hello there!

    I fixed the problem months ago with this approach:

    1. Make sure you have pulseaudio and pulseaudio-alsa installed.
    2. list your outputs with pacmd list-sinks | grep -e 'name' -e 'index'
    3. Find the one you’d like to be default, like:
    index: 7
    	name: <alsa_output.usb-SteelSeries_Siberia_Raw_Prism_Headset-00.analog-stereo>
    	alsa.name = "USB Audio"
    
    1. Open the file /etc/pulse/default.pa and find the line:
      set-default-sink output
      and replace it with:
      set-default-sink alsa_output.usb-SteelSeries_Siberia_Raw_Prism_Headset-00.analog-stereo
      Also add the lines:
      # automatically switch to newly-connected devices
      load-module module-switch-on-connect

    Let me know how it works!

  • @Jakobnissen said in Switch audio to headphones automatically:

    automatically switch to newly-connected devices

    load-module module-switch-on-connect

    Thanks for joining in here @Jakobnissen ! i forget about this one, i have this enabled to get my bluetooth headset automaticly switching to default output…

    I would swear this will solve the issue…
    Also when i do not need this to get a hardplugged headphone switch automatic to default autput!
    I try now without this option enabled and audio switches still…

    [updates once a week] = [90% less problems]
    http://gofccyourself.com
    howto-install-antergos
    how to add system logs
    i3 GNOME

  • Nope.

    How many devices should it display?

    pacmd list-sinks | grep -e 'name' -e 'index'
    
      * index: 0
    	name: <alsa_output.pci-0000_00_1f.3.analog-stereo>
    		alsa.name = "ALC256 Analog"
    		alsa.subdevice_name = "subdevice #0"
    		alsa.card_name = "HDA Intel PCH"
    		alsa.long_card_name = "HDA Intel PCH at 0xdfc28000 irq 130"
    		alsa.driver_name = "snd_hda_intel"
    		device.vendor.name = "Intel Corporation"
    		device.product.name = "Sunrise Point-LP HD Audio"
    		device.profile.name = "analog-stereo"
    		alsa.mixer_name = "Realtek ALC256"
    		device.icon_name = "audio-card-pci"
    				device.icon_name = "audio-speakers"
    				device.icon_name = "audio-headphones"
    
    

    I have alsa-firmware is installed.
    Does not look like this as posted above, nothing just happens when plugged in.

    pavucontrol still shows headphones (unplugged) wether plugged in or not. I can still manually change it.

  • @Irto Well it should display each of your devices.

  • @Jakobnissen said in Switch audio to headphones automatically:

    @Irto Well it should display each of your devices.

    Right. Well, this didn’t work for me :(

  • allways a good idea is to reset all pulseaudio setting for the user:

    mv ~/.config/pulse ~/.config/pulse.old
    

    [updates once a week] = [90% less problems]
    http://gofccyourself.com
    howto-install-antergos
    how to add system logs
    i3 GNOME

automatically7 headphones6 audio30 switch13 Posts 20Views 1108
Log in to reply