2

I have an XPS-13 9380, running Ubuntu 20.04, and have installed Ubuntu Studio Controls on it, with which I can start up JACK and bridge pulseaudio to JACK. This works great, except that when I plug in my headphones, it doesn't switch to playing back audio out of the headphones; it just leaves it coming out of the computer speakers. On the other hand, when I'm using pulseaudio on its own, without running JACK, a dialog automatically comes up about switching to headphones when I plug them in, and that works great.

Is there a way to make the switch happen when pulseaudio is bridging to JACK? Ideally it would happen automatically when I plug or unplug the headphones, but even a manual solution would be fine, so long as it's not too much of a pain each time to switch.

Thanks!

1 Answer 1

2

In case anyone else is stuck on this, I found an OK solution for myself: creating two bash scripts and adding keyboard shortcuts to them. To switch to speakers:

#! /bin/bash

amixer -c 0 set Speaker unmute
amixer -c 0 set Headphone mute
amixer -c 0 set Speaker 100%
amixer -c 0 set Headphone 100%

...and to switch to headphones:

#! /bin/bash

amixer -c 0 set Speaker mute
amixer -c 0 set Headphone unmute
amixer -c 0 set Speaker 100%
amixer -c 0 set Headphone 100%

I keep both at 100% volume but toggle which one is muted. This feels klugey, but works for now. Maybe someone has a better idea!

3
  • That's the way to go, you have to handle this via alsa. There exists a nice GUI for alsamixer called qasmixer, it's really useful when working with jack. You can install it with sudo apt install qasmixer.
    – mook765
    Jan 29, 2021 at 6:28
  • @MarcTheSpark Works for me in Ubuntu Studio 20.04! I have a Microsoft Surface Laptop 4 running Ubuntu Studio, at some point whilst I was away travelling, the headphone jack stopped recognising when headphones were plugged in and switching the audio between headphone and jack, so I've had to use scripts like this, though mine uses pacmd. Trouble is, at some point, Ubuntu Studio has updated and now uses PA bridged to JACK so pacmd no longer works. This does though, I guess as ALSA is being used at the lowest level. Otherwise I have to stop JACK and restart PA to be able to switch with pacmd
    – drkvogel
    Sep 27, 2022 at 10:50
  • @mook765 In qasmixer, I can't find any way to switch between headphones and speakers. Also, it crashes if I touch arcam_av!
    – drkvogel
    Sep 27, 2022 at 10:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .