Mute speaker when audio cable plugged in?

Right now I can hear sound from the internal speakers and external ones connected to the 3.5mm jack.

Is there a way to mute the internal speaker when a headphone cable or other audio cable is plugged into the 3.5mm jack?

1 Like

I see the same issue.

Sometimes on other systems, IIRC, when you plug in headphones there will be separate controls for the speakers and the headphones as controlled by pavucontrol. I tried changing it in pavucontrol, but I only saw the ā€œSpeakersā€ option under ā€œOutput Devicesā€ and ā€œPort:ā€.

Under ā€œConfigurationā€ there is a ā€œPro Audioā€ option, but Iā€™m not really sure what that is for. Changing it didnā€™t help to control headphones/speaker though.

alsamixer also didnā€™t list other controls, just one Master control.

On the big reform there is this issue which will likely get fixed for good with motherboard 2.6: [wm8960] jack sensing broken: plugging or unplugging of the headphones has no effect (#8) Ā· Issues Ā· Reform / reform-debian-packages Ā· GitLab

To work around this, I have a button in my waybar to toggle the speakers on and off manually:

    "custom/patoggle": {
        "format": "{}",
        "interval": "once",
        "return-type": "json",
        "exec": "patoggle status",
        "on-click": "patoggle",
        "signal": 8
    },  

And in my ~/.local/bin/patoggle I then have:

#!/bin/sh

set -eu

active_port=$(pactl --format=json list sinks | jq -r '.[] | select(.name == "alsa_output.platform-sound.stereo-fallback") | .active_port')

if [ "${1:-}" = "status" ]; then
	case $active_port in
	analog-output-speaker) echo '{"text": "šŸ”ˆ", "tooltip": "speakers"}';;
	analog-output-headphones) echo '{"text": "šŸŽ§", "tooltip": "headphones"}';;
	esac
else
	case $active_port in
	analog-output-speaker) pactl set-sink-port alsa_output.platform-sound.stereo-fallback analog-output-headphones;;
	analog-output-headphones) pactl set-sink-port alsa_output.platform-sound.stereo-fallback analog-output-speaker;;
	esac
	pkill -SIGRTMIN+8 waybar
fi
5 Likes

@josch, thanks for your explanation and script. It seems discord changed some of the code, such as (perhaps) ā€œcolon speakers colonā€ and ā€œcolon headphones colonā€ into emojisā€¦

When you press F6 in alsamixer, you can switch to the real soundcard, which has controls for headphone, speaker and a lot more knobs. You can also press M there to toggle specific faders/controls on or off.

Toggling this in pavucontrols indeed remains an important TODO. Iā€™m not sure why this doesnā€™t work out of the box with the Pocketā€™s soundchip.

1 Like

That works in alsamixer. Hitting F6 and selecting tlv320aic3100 for the card instead of default gives control. Most of the faders donā€™t support M for mute for some reason though. Controlling the second Speaker option controls the Pocket speaker. The third Speaker appears to change the gain of the speaker. The DAC option controls the headphones. HP Analog affects the headphones too, but seemed choppy when changing, but DAC was smooth.

Thanks!

No, I literally have these characters in that file so that the icons become the buttons in my waybar.

2 Likes

Ah nifty! I need to get out of 1990s console thinking. :wink:

Not a perfect solution but Iā€™ve been using usb dongle DACs with my phone and big reform and that switches the speakers off when connected.

I still donā€™t understand how this is supposed to work. Right now, audio on my Pocket Reform is entirely unusable because it either comes out of the speaker AND the headphone port or not at all.

My most common use case (and I think generally a common one for a mobile device which gets used in shared spaces with other people) is to use headphones and NO speaker, but how to achieve this is a mystery to me and I donā€™t understand how this is even a thing.

I guess I could disconnect the speaker entirely but that feels like really approaching the problem from the wrong end and would also remove a feature from the device that might still have its use cases.

Update: I figured out that alsamixer isnā€™t actually the thing that pops up when you go to ā€œVolume Controlā€ through the waybar widget. I tried to hit F6 there to get to those supposed headphone settings and nothing happened.

alsamixer is a different tool that needs to be run from a terminal.

So now I can at set the speaker and headphone volume independently which is a huge step forward.

More details in alsamixer:

  • ā€œDACā€ seems to be the overall output level, for speaker AND headphones, so careful when youā€™re using both
  • ā€œSpeaker Analogā€ controls the speaker level (with ā€œSpeaker Driverā€ acting as an extra gain?)
  • ā€œHP Analogā€ controls the headphone jack level (with ā€œHP Driverā€ acting as an extra gain?)
  • alias mixer="alsamixer -c 1" to open it with the device you probably want right away (no F6 switching)
6 Likes

Iā€™m having this problem here with the RK3588 board and none of the scripts or options mentioned above successfully mute the speakers separately from the headphone jack.