I'm trying to write a bash script to find the percentage of the sound volume. I used this:
amixer get Master | awk '/Mono.+/ {print $6=="[off]"?$6:$4}'
This command prints the volume percentage of Master
channel, or prints [off]
if it's muted.
However, as you can see from screenshot below, the percentage that amixer get Master
outputs is different from the percentage that alsamixer
shows in the Master
channel.
What's the difference? Which one is the real percentage of my Master
channel? How can I get the percentage that alsamixer
shows (if it's the real one)?
Best Answer
From
man 1 alsamixer
:Then from
man 1 amixer
:Therefore use
amixer -M get Master
.