PINE64
Mute speakers when headset is plugged in - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: Pinebook (https://forum.pine64.org/forumdisplay.php?fid=76)
+--- Forum: Linux on Pinebook (https://forum.pine64.org/forumdisplay.php?fid=79)
+--- Thread: Mute speakers when headset is plugged in (/showthread.php?tid=4943)



Mute speakers when headset is plugged in - leszek - 08-16-2017

Somehow when I plug in a headset sound is played through it but the speakers don't mute and still play sound still.
I like to have the behavior to mute the speakers if I plug in my headphones or headset.
I guess I  need to enable some switch in alsamixer to make it work.


RE: Mute speakers when headset is plugged in - Luke - 08-16-2017

(08-16-2017, 02:25 PM)leszek Wrote: Somehow when I plug in a headset sound is played through it but the speakers don't mute and still play sound still.
I like to have the behavior to mute the speakers if I plug in my headphones or headset.
I guess I  need to enable some switch in alsamixer to make it work.

Witaj ;Wink

This is a known problem - I believe that anarsoul was looking into it sometime ago. So for now, you will need to manually mute speakers in alsamixer.


RE: Mute speakers when headset is plugged in - k_mp - 08-20-2017

(08-16-2017, 03:07 PM)Luke Wrote:
(08-16-2017, 02:25 PM)leszek Wrote: Somehow when I plug in a headset sound is played through it but the speakers don't mute and still play sound still.
I like to have the behavior to mute the speakers if I plug in my headphones or headset.
I guess I  need to enable some switch in alsamixer to make it work.

Witaj ;Wink

This is a known problem - I believe that anarsoul was looking into it sometime ago. So for now, you will need to manually mute speakers in alsamixer.

Hi Luke,

In case the issue has not fixed yet, I wrote a simple patch using acpi_listen to automatically mute/unmute when audio jack plugs in/out.
https://github.com/kasramp/PinebookScripts/tree/master/speaker_headphone_fix

Let me know if you have any question.


RE: Mute speakers when headset is plugged in - Luke - 08-21-2017

(08-20-2017, 03:38 AM)k_mp Wrote:
(08-16-2017, 03:07 PM)Luke Wrote:
(08-16-2017, 02:25 PM)leszek Wrote: Somehow when I plug in a headset sound is played through it but the speakers don't mute and still play sound still.
I like to have the behavior to mute the speakers if I plug in my headphones or headset.
I guess I  need to enable some switch in alsamixer to make it work.

Witaj ;Wink

This is a known problem - I believe that anarsoul was looking into it sometime ago. So for now, you will need to manually mute speakers in alsamixer.

Hi Luke,

In case the issue has not fixed yet, I wrote a simple patch using acpi_listen to automatically mute/unmute when audio jack plugs in/out.
https://github.com/kasramp/PinebookScripts/tree/master/speaker_headphone_fix

Let me know if you have any question.

Very good job! seems to work perfectly. Will make sure to have ayufan see this so it can be included in future images Smile


RE: Mute speakers when headset is plugged in - rookieone - 08-23-2017

Thank you, this is very usefull ! Smile

Below it showed that the range for 'headphone volume' is from 0-63, and for ' speaker volume' 0-31.

Code:
root@pinebook:/etc/acpi# amixer -c 1 sset 'headphone volume' 35
Simple mixer control 'headphone volume',0
 Capabilities: volume volume-joined
 Playback channels: Mono
 Capture channels: Mono
 Limits: 0 - 63
 Mono: 35 [56%]
root@pinebook:/etc/acpi# amixer -c 1 sset 'speaker volume' 35
Simple mixer control 'speaker volume',0
 Capabilities: volume volume-joined
 Playback channels: Mono
 Capture channels: Mono
 Limits: 0 - 31
 Mono: 31 [100%]

On my PB I've changed the values as below. Further I had to add the -c 1 option for selecting the right card.

Code:
#!/bin/bash

case "$1" in
   jack/headphone)
       case "$3" in
           plug)
               amixer -c 1 sset 'speaker volume' 0
               # amixer -D pulse sset Master 50% not working yet
               amixer -c 1 sset 'headphone volume' 35
           ;;
           unplug)
               amixer -c 1 sset 'headphone volume' 0
               # amixer -D pulse sset Master 50% not working yet
               amixer -c 1 sset 'speaker volume' 31
           ;;
       esac
   ;;
esac

p.s. I really recommend to NOT set 'headphone volume' to the maximum of 63, it will probably will be way to loud! (i tried till 51, too loud alread! Wink