[pulseaudio-discuss] unplug, plug ear buds (3.5mm laptop jack), my daily routine [better way pls?]

pulseaudio at zq3q.org pulseaudio at zq3q.org
Fri Feb 21 15:07:01 UTC 2020


I use audio via ear buds for phone calls on my laptop.

As part of my routine, I hibernate my laptop (fedora 30) nightly.  So every
morning I unplug and plug back in my ear buds. Nothing else I do has the same
effect. If I do not do this the audio out level is low, and no CLI approach to fix
this worked for me.

Eventually I may wear out the jack, and it is "just one more thing" I have to
do daily.  Is there a programatic way to get the same effect?

Also, I have to go into pavucontrol to manually change the system to use the
headset microphone.

Finally I run a bash function '_sr' ( as in "sound reset" / see after my sig ) to unmute, and
ensure that the levels for headphone mic and output are correct. I'm sure that
the '_sr()' needs fixup, but it does help me.

Any constructive tips appreciated!

--
thanks!,
Tom

---
$ type  _sndrst _sndmasteron  _sndcaptureon  _sndheadsetmic_select _rectst _rectest; : My bash functions /needs work/.
_sndrst is a function
_sndrst ()
{
    : personal function, _func_ok2unset_;
    ( : :sound reset:_sndreset:sound levels : TODO unmute all;
    set -e;
    ( set -xeu;
    _sndmasteron;
    _sndcaptureon );
    echo;
    _sndheadsetmic_select;
    echo;
    : Volume: 41944 =~ -11.6dB;
    ( set -x;
    amixer cset "numid=3,iface=MIXER,name='Master Playback Volume'" 41944 );
    echo;
    ( set -x;
    amixer cset "numid=1,iface=MIXER,name='Capture Volume'" 26870 );
    echo;
    ( set -x;
    amixer cset "numid=2,iface=MIXER,name='Capture Switch'" on );
    echo;
    ( set -x;
    amixer -c 1 cset "numid=9,iface=MIXER,name='Capture Switch'" on );
    echo;
    ( set -x;
    amixer -c 1 cset "numid=12,iface=MIXER,name='Internal Mic Boost Volume'" 0 );
    echo );
    return;
    : end '_sndrst()'
}
_sndmasteron is a function
_sndmasteron ()
{
    : personal function, _func_ok2unset_ :sound:amixer:unmute mic;
     <<'____eohd'
    https://askubuntu.com/questions/65764/how-do-i-toggle-sound-with-amixer
    https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/496354

____eohd

    ( set -e;
    set -o pipefail;
    if amixer -D pulse get Master | fgrep --color=auto -q '[off]'; then
        amixer -D pulse set Master 1+ toggle;
    fi );
    return;
    : end: '_sndmasteron()'
}
_sndcaptureon is a function
_sndcaptureon ()
{
    : personal function, _func_ok2unset_ :sound:amixer:unmute mic;
     <<'____eohd'
    https://askubuntu.com/questions/65764/how-do-i-toggle-sound-with-amixer

____eohd

    ( set -e;
    set -o pipefail;
    if amixer -D pulse get Capture | fgrep --color=auto -q '[off]'; then
        amixer -D pulse set Capture 1+ toggle;
    fi );
    return;
    : end: '_sndcaptureon()'
}
_sndheadsetmic_select is a function
_sndheadsetmic_select ()
{
    : personal function, _func_ok2unset_;
    ( set -x;
    amixer -c 1 cset "numid=7,iface=MIXER,name='Capture Source'" 1;
    amixer -c 1 cset "numid=12,iface=MIXER,name='Internal Mic Boost Volume'" 0 );
    return;
    : end: '_sndheadsetmic_select()'
}
_rectst is a function
_rectst ()
{
    : personal function, _func_ok2unset_;
    _rectest "$@"
}
_rectest is a function
_rectest ()
{
    : personal function, _func_ok2unset_;
    (  <<'____eohd'
    SYNOPSIS

    DESCRIPTION

        Tips: alsamixer for levels, pavucontrol for vu mic meter and speaker vu meter.
        Also consider echo test - see Contact "phonetest".

    TAGS
        :record test:sound test

____eohd

    seconds=${1:-4}
    : Fractional seconds not ok.;
    set -xeu;
    arecord -d $seconds /tmp/test-mic.wav;
    aplay /tmp/test-mic.wav );
    : end '_rectest()'
}
$


More information about the pulseaudio-discuss mailing list