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

What other apps and distros do you use to round out your studio?

Moderators: MattKingUSA, khz

Post Reply
ThatJackElliott
Established Member
Posts: 57
Joined: Thu Jul 27, 2023 4:06 pm
Been thanked: 3 times

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

Post 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!

-- Jack Elliott
They'll never take me alive

User avatar
erlkönig
Established Member
Posts: 210
Joined: Tue May 31, 2022 8:58 am
Has thanked: 42 times
Been thanked: 48 times

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

Post 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

Currently working with
https://www.honeysuckers.rocks/?lang=en
Fiddling with sequencers does not evolve into music necessarily and Mac users have smelly feet and guzzle little children.

User avatar
nikgnomicradio
Established Member
Posts: 109
Joined: Wed Feb 07, 2018 9:31 pm
Has thanked: 1 time
Been thanked: 7 times
Contact:

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

Post 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
ThatJackElliott
Established Member
Posts: 57
Joined: Thu Jul 27, 2023 4:06 pm
Been thanked: 3 times

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

Post 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.

-- Jack Elliott
They'll never take me alive

Post Reply