Command to mute and unmute a microphone
Solution 1:
Go to System Preferences then Keyboard and click Shortcuts then Custom Shortcuts:
Click on Add
Fill in:
Toggle Microphone
and
amixer set Capture toggle
For USB webcams you need to chose the device (-c 1
), or maybe another number.
amixer -c 1 sset Mic toggle
Click Apply and then associate a new key with this command (e.g. the Pause/Break key).
Solution 2:
You can mute the microphone with
amixer set Capture nocap
and unmute the microphone with
amixer set Capture cap