You are not logged in.

#1 2013-12-30 14:47:59

oarmstrong
Member
From: London, UK
Registered: 2013-12-30
Posts: 5
Website

[SOLVED] amixer and alsamixer differences

Hi.  When I started this install I installed cinnamon DE to test it out.  As expected it conveniently set up all the audio stuff for me (using what appeared to be pulseaudio with ALSA).  With this I was able to use `amixer set Master 10%` (for example) and it would correctly set the audio volume to 10%, reflected by stdout of that command and `alsamixer`.

However, now I've switched back to dwm and after having issues with pulseaudio I switched back to the standard ALSA set up.  The problem now is that if I execute the command `amixer set Master 10%`, stdout returns that it has set it to 12% and alsamixer shows 3/100 on the bar.

Is there anything I can do to get amixer and alsamixer to play nice together again?  If not, is there a better way of setting the volume through a command which is reliable?  Also I would need a way of reading the current volume as I have that displayed in my dwm status bar (with xsetroot -name).

Also, when I run `amixer set Master 5%+` (which is bound to my media volume increase key) it will increase by somewhere in the region of 6-8% depending on what is is before running.

Any pointers would be appreciated.  I don't necessarily need to fix this inconsistency, only need a way of setting and getting the current ALSA volume through a command which is consistent with the actual audio volume as reported by alsamixer.

Last edited by oarmstrong (2013-12-30 15:03:50)

Offline

#2 2013-12-30 14:59:21

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] amixer and alsamixer differences

https://bbs.archlinux.org/viewtopic.php?pid=1054701
'amixer set Master 10%' returns 13% in stdout and 5/100 in alsamixer here.

Last edited by karol (2013-12-30 14:59:57)

Offline

#3 2013-12-30 15:03:37

oarmstrong
Member
From: London, UK
Registered: 2013-12-30
Posts: 5
Website

Re: [SOLVED] amixer and alsamixer differences

karol wrote:

https://bbs.archlinux.org/viewtopic.php?pid=1054701
'amixer set Master 10%' returns 13% in stdout and 5/100 in alsamixer here.

Thanks, this post explained exactly how to get amixer to user alsamixer units.

Offline

#4 2013-12-30 15:07:32

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [SOLVED] amixer and alsamixer differences

I suspect it is just a matter of how alsamixer does it's rounding.  If you dig into /proc/asound/ you'll see that volume levels are not stored in percents, but rather a hex value which in my case ranges from 0 to 0x4a (or 74) and has a step size of 0x03.  74/3 is 24.6666 actual steps possible.  24.6666 * 10% = 2.46666 which could be rounded down to 2, or up to 3.  2 / 24.6666 = 12.16 % which in turn might get rounded for display.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB