Amarok + PulseAudio: volume control changes global volume

Colin Guthrie gmane at
Mon Jul 5 11:10:03 BST 2010

Hi Nikos,

Sorry for the late reply, real life getting in the way etc. etc. :p

'Twas brillig, and Nikos Chantziaras at 26/06/10 07:26 did gyre and gimble:
> Here's what PA says when I change volume in Amarok (which also changes
> "Master" in kmix and alsamixer):
> ------------
> D: protocol-native.c: Client amarok changes volume of sink input audio
> stream.
> D: alsa-sink.c: Requested volume: 0:  51% 1:  51%
> D: alsa-sink.c: Got hardware volume: 0:  51% 1:  51%
> D: alsa-sink.c: Calculated software volume: 0: 100% 1: 100%
> (accurate-enough=yes)
> I: module-stream-restore.c: Storing volume/mute/device for stream
> sink-input-by-media-role:music.
> ------------

This is sadly very little to go on. I'd really need to see the output
for both a volume increase and a volume decrease.

As stated before (and clarified by Ian), PA is meant to *increase* the
Master volume if needed.

e.g. if the Volume in Amarok is 51% and it is the only stream playing
then it is possible that the Sink Volume (which is kinda similar to the
ALSA Master volume but not necessarily a 1:1 mapping due to how PA deals
with/combines the lower level controls: is also at 51%.

If that is the case, and the Amarok Volume is increased to say 60%, then
the Sink Volume *has* to increase too in order to allow you to hear what
is going on. Once this is done, you'll have both Amarok and the Sink
volume at 60%, but if you then decrease the Amarok volume, the Sink
volume should remain at 60%. When this happens you should see the
"Calculated software volume" bit report something less than 100% (aka
0dB) as the software has to compensate for the difference between the
two scenarios.

So to get some useful debug and confirm this issue you really need to
show me the volume up and down case.

> And here what it says when I change volume in kmix or alsamixer (which
> also changes the Amarok volume slider):
> ------------
> D: alsa-sink.c: Read hardware volume: 0:  52% 1:  52%
> I: module-device-restore.c: Storing volume/mute/port for device
> sink:alsa_output.pci-0000_05_02.0.analog-stereo.
> ------------

This bit looks normal.

As we internally store the volume of the amarok stream relative to the
Sink volume, as you increase this Master volume in ALSA, PA will read
this in as an "external" change.

If we have a setup whereby amarok volume is 51% and the Sink volume is
also 51% then the the "amarok volume relative to sink volume" is +0%

Increasing the sink volume keeps the same relative change so Amarok gets
louder and the volume is increased accordingly to match.

In other words, what the slider in Amarok says is now "absolute" rather
than "relative". A volume of 50% is the 50% regardless of what the sink
volume is. Previously it would have been 50% of whatever the output
volume is.

>From the output you've shown so far, I'm not 100% convinced it is a
problem, it could just be the expected behaviour of the flat volume
system (the only thing that makes me unsure of this is that you've
previously said that alsa:master is affected when you reduce the volume
in amarok too which is unexpected).

> I'm also attaching the output of "pacmd ls", "amixer -c0", "sudo lsof
> /dev/snd/* /dev/dsp*" and "getfacl /dev/snd/*" to this email.

Thanks. The only strange thing in all that is that your user does not
appear to be part of the ACL on the sound device nodes which suggests
some kind of problem with your consolekit/udev setup.

I presume that in order to be allowed to open the audio devices, your
user (realnc?) is a member of the audio group? This generally does not
make sense in a typical desktop setup where consolekit/udev is
responsible for ensuring the "ACTIVE" user (as defined by consolekit)
has r/w permission on the revelvant h/w nodes (not just sound, but other
things too) via adding/removing ACLs. If users are manually put into the
audio group then this breaks things like User Switching. This may not be
a problem in your case, but figured it was best to mention it as I saw it :)

Take Care



Colin Guthrie

Day Job:
  Tribalogic Limited []
Open Source:
  Mandriva Linux Contributor []
  PulseAudio Hacker []
  Trac Hacker []

More information about the kde-multimedia mailing list