You are not logged in.

#1 2012-02-08 17:34:02

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

[solved] amixer output differs from alsamixer?

Hey all,

I just found out that amixer reports a different volume value than alsamixer does. What is the cause of this and is this default behaviour?

Here's amixer's output:

┌─[jente@lappy ~][18:31:19] 
└─■ amixer get Master
Simple mixer control 'Master',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined penum
  Playback channels: Mono
  Limits: Playback 0 - 64
  Mono: Playback 48 [75%] [-16.00dB] [on]

And alsamixer says 50.

Last edited by Unia (2012-02-08 19:51:42)


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#2 2012-02-08 17:39:30

Gusar
Member
Registered: 2009-08-25
Posts: 3,605

Re: [solved] amixer output differs from alsamixer?

Offline

#3 2012-02-08 18:58:35

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: [solved] amixer output differs from alsamixer?

Yes I noticed that, but it doesn't explain why it's different. (I created a new post because the one you linked me to is old)


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#4 2012-02-08 19:01:51

Gusar
Member
Registered: 2009-08-25
Posts: 3,605

Re: [solved] amixer output differs from alsamixer?

It indeed doesn't. But how exactly do you think we can know why? Digging into the code, that's the only way. There must be an error somewhere in the alsamixer code.

Offline

#5 2012-02-08 19:51:33

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: [solved] amixer output differs from alsamixer?

I just thought there might be an explanation. Anyway, I'll mark this solved. Thanks!


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#6 2012-06-11 05:36:21

gogi-goji
Member
From: Canada
Registered: 2009-10-20
Posts: 73
Website

Re: [solved] amixer output differs from alsamixer?

Hopefully I'm not too late to the party here, but I just discovered this discrepancy myself and was trying to find out why this is the case.  This thread was one of the top results in my search, but offered no reason as to why this discrepancy exists.  Upon further searching, I found the reason explained on another forum (http://www.mentby.com/Group/alsa-list/a … ongly.html).  Edit: This quote probably originated here from the alsa-devel mailing list.  http://mailman.alsa-project.org/piperma … 50146.html

Takashi wrote:

No, both are correct.  You are dreaming too much on the world unified
percentage representation smile

The percentage in amixer has nothing to do with dB level.
It's just the percentage of the raw value range of that mixer
element.  Thus showing 89% is correct.  It's 10% down from 100%
(1% is because of the resolution of the raw values).

Now, alsamixer shows the percentage in a different way.  It's
explained well in the source code (alsamixer/volume_mapping.c), but
not mentioned in the man page, unfortunately.

* The mapping is designed so that the position in the interval is proportional
* to the volume as a human ear would perceive it (i.e., the position is the
* cubic root of the linear sample multiplication factor).  For controls with
* a small range (24 dB or less), the mapping is linear in the dB values so
* that each step has the same size visually.  Only for controls without dB
* information, a linear mapping of the hardware volume register values is used
* (this is the same algorithm as used in the old alsamixer).

The percentage representation in alsamixer corresponds to this
mapping, thus it's neither dB nor linear percent.

Hopefully this helps clear up why there is a difference for some other people, too!

Last edited by gogi-goji (2012-06-11 05:42:52)


My (sporadically updated) blog
My miscellaneous dotfiles

Offline

#7 2013-01-15 07:04:33

wakkadojo
Member
Registered: 2009-05-31
Posts: 50

Re: [solved] amixer output differs from alsamixer?

Looking at the amixer man page, the mapping mentioned earlier can be invoked in amixer with the -M flag. So using amixer -M [...] works in the units that you see in alsamixer. These are "more natural for human ear".

For example, to get the master in the alsamixer units, use

amixer -M get Master

The command works similarly with

amixer -M set Master 5%+

to raise the volume by 5% in the alsamixer units, for example.

Offline

Board footer

Powered by FluxBB