TransWikia.com

Alternate mike / speakers

Unix & Linux Asked by Tarass on October 30, 2021

I’d like to switch off/on alternatively the microphone and the speakers with a simple click to avoid looping the voice in the speakers in a conversation.
Is there such a possibility in a easy way ?

I thought maybe about a script, but in this case what are the bash commands to switch off/on the microphone and the speakers and how to test witch are on ?

Ubuntu 18.04 with Alsa.
Thank you.

One Answer

There is a command-line tool amixer which should allow you to perform the necessary tasks.

First, run

amixer controls

to get a list of control options. You will likely get output like

numid=XX,iface=MIXER,name='Master Playback Switch'

...

numid=YY,iface=MIXER,name='Capture Switch'

You can get the status of the control option with

$ amixer cget name='Master Playback Switch'
numid=XX,iface=MIXER,name='Master Playback Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=off

To set, use

$ amixer cset name='Master Playback Switch' 'on'      
numid=XX,iface=MIXER,name='Master Playback Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on

So, to switch to "speak" mode, you could use

amixer cset name='Master Playback Switch' 'off'; amixer cset name='Capture Switch' 'on'

and to switch to "listen" mode:

amixer cset name='Capture Switch' 'off'; amixer cset name='Master Playback Switch' 'on'

Answered by AdminBee on October 30, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP