Page 1 of 1

Mute/unmute a JACK/ALSA output from command line?

Posted: Tue Aug 01, 2023 7:47 pm
by ThatJackElliott

Okay you smart people, here's yet another question: Is there a command that can be used in Terminal that will mute/disable the audio coming from a Playback card, then a complementary command that will unmute/enable the device?

Thank you!


Re: Mute/unmute a JACK/ALSA output from command line?

Posted: Wed Aug 02, 2023 6:34 am
by erlkönig

I don't know, if it's possible to do this with jack tools. Maybe you can script a mixer from cli?

What could work, is disconnect/connect the connections. Have a look on
jack_lsp
jack_connect
jack_disconnect


Re: Mute/unmute a JACK/ALSA output from command line?

Posted: Wed Aug 02, 2023 11:50 am
by nikgnomicradio

To mute/unmute ALSA output I use:

Code: Select all

amixer sset --quiet --card=0 'PCM' mute

Code: Select all

amixer sset --quiet --card=0 'PCM' unmute

Users on other systems may need a different card number (or name) for the correct audio device
and a different name for the relevant ALSA mixer control e.g. Master, Speaker, Headphones etc

use aplay -l to find card NUMBER/NAME

and amixer --card=NUMBER/NAME to see list of mixer controls for card

There is also a command to toggle mute state:

Code: Select all

amixer sset --quiet --card=0 PCM toggle

Re: Mute/unmute a JACK/ALSA output from command line?

Posted: Wed Aug 02, 2023 6:43 pm
by ThatJackElliott

Hey, thank you! It looks like the target card has no controls that amixer can find. Other cards return simple controls with amixer but this one returns empty -- it is too dumb to have any kind of mute controls that I can get my hands on.