This is very odd, i have one default microphone and i have another second microphone. When i use this command it always shows not muted but the microphone volume is 0%. How or what is a way i can find those value accurately.
$ pactl list | sed -n '/^Source/,/^$/p' | grep Mute Mute: no Mute: no Mute: no 4 Answers
By using the Pulseaudio Command Line Interface we will obtain a lot of information on available sources
pacmd list-sourceswill display a rather lengthy list. The current active input is marked with an asterisk. We could combine this with grep but will then lose information for which source the outputs are valid
pacmd list-sources | grep volumeTo set an output to a defined value we need to know it's index which is also given by list-sources to issue
pacmd set-source-volume <index> <value> # value: 0 = mute 65536 = 100%We may also need to unmute the sink source with
pacmd set-source-mute <index> 0 You access this information with amixer.
To list all sound controls you can issue the command
$ amixer controls
...
numid=18,iface=MIXER,name='Capture Source'
numid=19,iface=MIXER,name='Capture Switch'
numid=20,iface=MIXER,name='Capture Volume'
...and then read the values of the controls with
$$ amixer cget numid=20
numid=20,iface=MIXER,name='Capture Volume' ; type=INTEGER,access=rw---R--,values=2,min=0,max=15,step=0 : values=0,0 | dBscale-min=0.00dB,step=1.50dB,mute=0Check out the man pages of amixer. Interesting is also alsamixer, which gives you a more intuitive command line interface.
This is a simple solution to toggle/untoggle the microphone mute with one line
I believe this helps
I created a mictoggle online script
$ cat /usr/local/bin/mictoggle
pactl list sources | grep -qi 'Mute: yes' && pactl set-source-mute 1 false || pactl set-source-mute 1 true 2 I wanted to do this via pactl and this is what I came up with:
# Get active audio source index
CURRENT_SOURCE=$(pactl info | grep "Default Source" | cut -f3 -d" ")
# List lines in pactl after the source name match and pick mute status
pactl list sources | grep -A 10 $CURRENT_SOURCE | grep "Mute: yes"