Bug 501972

Summary: Volume goes crazy sometimes
Product: [Fedora] Fedora Reporter: bobpoljakov
Component: pulseaudioAssignee: Lennart Poettering <lpoetter>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: low    
Version: 11CC: antonbaklanov, aquarichy, axet, beland, belegdol, bnocera, chkr, dpnaessens, dtimms, felix, germano.massullo, gnomeuser, jeff, johnthacker, joshua, lkundrak, lpoetter, michel, mikem, m.luke.myers, seanlkml, splewako, talcite, tcallawa, um.kiwon, wtogami
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-10-17 01:00:01 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 513576    
Bug Blocks: 510499    

Description bobpoljakov 2009-05-21 13:39:00 UTC
Description of problem:
When I'm listening music with banshee, sometimes volume starts to go extremely high (Output: 135%) after a song change. After I lower the volume scrolling on the panel applet, and banshee starts the next song, volume goes high again. If I open the sound preferences/applications, and lower the volume there, it starts working right, but sometimes starts this 

Version-Release number of selected component (if applicable):
gnome-media-2.26.0-6.fc11.i586

How reproducible:
I don't know, listening music, changing volume by scrolling over the panel applet icon or by volume up/down multimedia key (fn+up or down arrow)

Steps to Reproduce:
1.
2.
3.
  
Actual results:
sometimes volume tear of my head

Expected results:
volume stays on a constant level if I don't change it

Additional info:

Comment 1 Bastien Nocera 2009-05-21 13:52:28 UTC
I don't see how this is a gnome-media problem...

Comment 2 bobpoljakov 2009-05-21 14:22:57 UTC
(In reply to comment #1)
> I don't see how this is a gnome-media problem...  

"yum whatprovides */gnome-volume-control-applet" says the applet is in gnome-media. I don't think it's a banshee problem because banshee's volume constantly full. But I haven't tried to generate this with other programs.

Comment 3 David Timms 2009-05-24 13:58:24 UTC
might be friend of bug 499952

Comment 4 David Nielsen 2009-05-24 14:25:47 UTC
Please test with another application such as totem, I highly doubt this is banshee - more likely target seem to be gstreamer, pulseaudio or alsa.

I have a similar issue, yet inverse, issue with totem where it keeps turning the volume down between loading videos.

Comment 5 Bug Zapper 2009-06-09 16:15:27 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 11 development cycle.
Changing version to '11'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 6 Matt Chan 2009-06-14 05:59:11 UTC
I can confirm this bug under firefox's flash npviewer.

Volume will sometimes jump to 135% between flash sessions (watching 2 videos for example)

Any hints for debug logs?

Comment 7 David Timms 2009-06-14 09:28:58 UTC
(In reply to comment #6)
> I can confirm this bug under firefox's flash npviewer.
Can you provide OS and package version numbers please, eg:
cat /etc/fedora-release
uname -a
rpm -qa kernel\* \*firefox\* \*pulse\* pad\* pav\* \*alsa\* nsplug\* flash\*|sort

> Volume will sometimes jump to 135% between flash sessions (watching 2 videos
> for example)
What suggests that the level is 135% ?
Is that while watching to videos at once, or sequentially ?

> Any hints for debug logs?  
If it only occurs with flash, and you are using the not open source flash player, then no.

Comment 8 Matt Chan 2009-06-14 13:19:35 UTC
[matthew@laptop ~]$ cat /etc/fedora-release
Fedora release 11 (Leonidas)
[matthew@laptop ~]$ uname -a
Linux laptop.unit2 2.6.29.4-167.fc11.i586 #1 SMP Wed May 27 17:14:37 EDT 2009 i686 i686 i386 GNU/Linux
[matthew@laptop ~]$ rpm -qa kernel\* \*firefox\* \*pulse\* pad\* pav\* \*alsa\* nsplug\*
kernel-firmware-2.6.29.4-167.fc11.noarch
pulseaudio-libs-0.9.15-11.fc11.i586
pulseaudio-libs-glib2-0.9.15-11.fc11.i586
pulseaudio-0.9.15-11.fc11.i586
kernel-2.6.29.4-167.fc11.i586
pulseaudio-utils-0.9.15-11.fc11.i586
padauk-fonts-2.4-3.fc11.noarch
nspluginwrapper-1.3.0-5.fc11.i586
alsa-plugins-pulseaudio-1.0.18-3.fc11.i586
alsa-lib-1.0.20-1.fc11.i586
pulseaudio-module-x11-0.9.15-11.fc11.i586
kernel-devel-2.6.29.4-167.fc11.i586
kerneloops-0.12-5.fc11.i586
pulseaudio-module-gconf-0.9.15-11.fc11.i586
pulseaudio-module-bluetooth-0.9.15-11.fc11.i586
firefox-3.5-0.20.beta4.fc11.i586
kernel-headers-2.6.29.4-167.fc11.i586
xine-lib-pulseaudio-1.1.16.3-2.fc11.i586
alsa-utils-1.0.20-3.fc11.i586
[matthew@laptop ~]$ flash\*|sort
bash: flash*: command not found


The exact value that volume jumps is from 100% to 141%. This is indicated by gnome-volume-control-applet

It is while watching videos sequentially.

I will test to see if this behaviour is repeated in other audio programs. 

There's a bug with very similar symptoms here: https://bugzilla.redhat.com/show_bug.cgi?id=505466 and https://bugzilla.redhat.com/show_bug.cgi?id=498158 and

Comment 9 Germano Massullo 2009-06-21 13:49:48 UTC
I've just experimented this shocking bug of having SUDDENDLY the volume at 100%

I was on my bed with headphones listening to music and reading a book (so, without touching the computer) and SUDDENDLY the volume was setted to 100%

Please fix carefully this bug, it can damage ear of users! Imagine a Sennheiser hd595 at 100% volume >:8 I'm still shocked.

Now, here informations about my computer.

Kde 4.2.3
Amarok 2.0.2

Opened programs while the bug happened:
Opera 10 beta1
Amarok (of course, I was listening to music with it)
Skype
Kopete
Emesene

[Caterpillar@Magic-3 ~]$ cat /etc/fedora-release
Fedora release 11 (Leonidas)

[Caterpillar@Magic-3 ~]$ uname -a
Linux Magic-3 2.6.29.4-167.fc11.i586 #1 SMP Wed May 27 17:14:37 EDT 2009 i686 athlon i386 GNU/Linux

[Caterpillar@Magic-3 ~]$ rpm -qa kernel\* \*firefox\* \*pulse\* pad\* pav\* \*alsa\* nsplug\*

wine-pulseaudio-1.1.21-2.fc11.i586
xine-lib-pulseaudio-1.1.16.3-2.fc11.i586
pulseaudio-0.9.15-11.fc11.i586
pulseaudio-module-x11-0.9.15-11.fc11.i586
kernel-2.6.27.24-170.2.68.fc10.i686
kernel-devel-2.6.29.4-167.fc11.i586
alsa-utils-1.0.20-3.fc11.i586
pulseaudio-module-bluetooth-0.9.15-11.fc11.i586
padauk-fonts-2.4-3.fc11.noarch
alsa-lib-1.0.20-1.fc11.i586
kernel-2.6.29.4-75.fc10.i686
kernel-2.6.29.4-167.fc11.i586
pulseaudio-libs-glib2-0.9.15-11.fc11.i586
alsa-plugins-pulseaudio-1.0.18-3.fc11.i586
kernel-headers-2.6.29.4-167.fc11.i586
kerneloops-0.12-5.fc11.i586
kernel-firmware-2.6.29.4-167.fc11.noarch
pulseaudio-libs-0.9.15-11.fc11.i586
pulseaudio-utils-0.9.15-11.fc11.i586
kde-settings-pulseaudio-4.2-10.20090430svn.fc11.noarch
nspluginwrapper-1.3.0-5.fc11.i586
firefox-3.5-0.20.beta4.fc11.i586
pavucontrol-0.9.8-1.fc11.i586
[Caterpillar@Magic-3 ~]$ flash\*|sort
bash: flash*: command not found

Comment 10 David Nielsen 2009-06-21 17:51:08 UTC
reassigning to pulseaudio sounds more right

Comment 11 Matt Chan 2009-06-21 19:18:14 UTC
More of a potential issue is when the volume exceeds 100%. 

It seems to be in a state where the sound card is potentially being damaged. There is severe crackling that won't stop until after the volume has been reset to 100% or lower. I've always been quick to reset the volume, so I'm not sure what the prolonged effects are. Someone who understands the hardware better could probably comment on the severity of this.

I'm not sure if this has a potential of damaging headphones or speakers. My T42 has a hardware mixer, so the problem has been limited to before the sound is processed by the mixer I believe.

Comment 12 Sean Estabrooks 2009-07-02 18:21:31 UTC
This happens with totem playing music too.  Was wearing headphones and bloody volume went to 100% between tracks and just about blew my eardrums.  This is a dangerous bug, and should not be considered "low" severity.   This bug actually has the potential to hurt people.   No joke.

Comment 13 Germano Massullo 2009-07-10 16:18:39 UTC
I totally agree with Sean Estabrooks. Please vote for a high severity.

Comment 14 Mike McLean 2009-07-29 18:44:22 UTC
dup of bug 488532?

Comment 15 joshua 2009-07-31 04:40:04 UTC
I am having the exact same problems... considering going back to F10 for my auditory safety

Comment 16 Alexey Kuznetsov 2009-08-06 08:23:22 UTC
same for totem / diablo2 under wine / firefox with flash

Comment 17 Alexey Kuznetsov 2009-08-06 08:24:15 UTC
in my cases it can jump in other directions to 0% or to 100%

Comment 18 Michel Lind 2009-09-20 01:17:21 UTC
*** Bug 520078 has been marked as a duplicate of this bug. ***

Comment 19 John Thacker 2009-09-27 01:02:55 UTC
This is related to bug 488532.

I have a soundcard (Audigy 2 variant using emu10k1 driver) and onboard sound (AMD 750 Southbridge, Realtek ALC888 chip, hda-intel codec).

When I have pulseaudio set to use the emu10k1 card, I get exactly the behavior I described when I filed bug 488532.

When I have pulseaudio set to use the on-board audio, I get exactly the behavior mentioned here.  Audio resets to a number over 100% whenever playback is started on rhythmbox.  This happens on track changes if I don't have crossfade enabled, and does not happen on track changes (but still happens when pausing and then playing again) if crossfade is enabled with 0s.

Note that I can completely remove the Audigy 2 card or disable the internal audio in the motherboard BIOS and still see this issue, so I don't believe that it's a problem of the two soundcards having different latency settings.

I haven't been able to reproduce this with banshee.  Is it correct that this only occurs sometimes with banshee, as opposed to every single track/stop/start with rhythmbox?

Comment 20 John Thacker 2009-09-27 05:31:35 UTC
Interesting.  I've found a way to not only duplicate the problem in rhythmbox and to reset things.  The two causes are:

1) Changes in the main pulseaudio volume made while rhythmbox is not running are then added to rhythmbox's previous volume level to produce a new main volume the next time rhythmbox starts.
2) The original pulseaudio volume level from before rhythmbox was started is restored when rhythmbox is quit.  

Also, somebody's not doing bounds checking and is allowing volumes over 0dB.  Perhaps the other applications are doing something similar; it's possible that what I'm describing has roots in gstreamer too.

To reproduce the original problem:
1) Lower the main pulseaudio volume (perhaps through g-v-m) while rhythmbox is not running or is paused, but not down to mute.  Note by how many dB you lowered the volume.
2) If paused, quit rhythmbox.  
3) Start rhythmbox and start playing; observe that both the rhythmbox and pulseaudio volume decreases.  
4) While playing, raise the rhythmbox volume slider all the way to 100%.  Observe that the pulseaudio volume also increases to 100%.
5) Quit rhythmbox.  Observe that the pulseaudio volume returns to its value from before rhythmbox was started.
6) Raise the pulseaudio volume to 100%.
7) Start rhythmbox and start playing.  Observe that the rhythmbox volume is still 100%, but the pulseaudio volume while playing is now the same number of decibels above 0dB as you lowered it in step 1. 
  
The quick reset is to set the main pulseaudio volume to 100% while rhythmbox is not running, start it and play something (turn off your speakers perhaps), and then use the *rhythmbox* volume control and slide it down and back up to 100%.  Then quit rhythmbox.  Rhythmbox has an override such that whenever you manually set the rhythmbox volume to 100%, it sets the main pulseaudio volume to 0dB/100% as well.

When playing, rhythmbox "takes over" the main pulseaudio volume control; sliding the rhythmbox slider affects main pulseaudio volume and vice versa.  This affects all other sounds on the system, instead of rhythmbox having an independent audio control that applied only to it.  Rhythmbox restores the previous pulseaudio volume level when quit (volume changes while paused will be considered the new previous level), and restores its own volume when restarted *but adds in any changes from changing the main pulseaudio volume.*  This combination is a problem.

You can have the main volume at -30 dB, start rhythmbox and raise it to 0 dB and quit.  The pulseaudio main volume is restored to -30 dB.  If you then raise the main volume by 30 dB to 0 dB, when rhythmbox is next started volume is somehow set to its old 0 dB + 30 dB for how the main volume changed when rhythmbox wasn't running.  No one's bounds-checking at this point, so the main volume becomes 30 dB and blasts your ears.

A secondary confusion for many users is that rhythmbox volume is linear amplitude volume and pulseaudio uses decibel power volume.

Rhythmbox volume is expressed as a float from 0 to 1.  Currently, this is taken by pulseaudio (or whatever is doing the conversion) to be proportional to the amplitude of the sound wave, or another way of putting it is is taken as the fraction of maximum sound wave amplitude to use (on a linear scale).  Thus, this is converted to decibels of power by the standard 20 log rule.  If rhythmbox sound is set to .671233 on the slider (I added some debug statements to check), then this is converted to a volume of 20 * log_10(.671233) = -3.4625 dB in pulseaudio.[1]  Pulseaudio then refers to this as 96% volume on my machine, because the sound card is able to go down to -90 dB.[3] 

In human perception, generally most people say that about 6 to 10 dB corresponds to a doubling of perceived loudness.  For my card, that means that using pulseaudio's expression of volume, 100% is roughly twice as loud as 90%, which is twice as loud as 80%, which is twice as loud as 70%, and so on all the way down.  This may not correspond with what users are used to, if they're used to linear amplitude volume.  Linear amplitude volume pretty closely tracks perceived loudness; 6 dB (power) difference is a multiplicative factor of 10^.3 = 1.995 in linear amplitude.

I don't like linear dB for normal users, because it provides a lot of fine control down in a range that they don't care about and is coarse up in the useful range.  (Or else is set so that 0dB is way too loud.)  It's probably much more useful for professionals who are used to dB, though.

[1] AIUI, Pulseaudio actually stores volume by using unsigned 16-bit integers, linearly scaled with dB so that the maximum value corresponds with max 100% volume/0dB.[2]

[2] Even this doesn't seem to be true.  They're actually unsigned 32-bit integers; 0 to 2^16 is used for "normal" volume ranges up to 0dB = 100% = 0x10000U.  Volumes higher than 100% can be assigned, all the way up to a really impossible number that would rupture your eardrums if your speakers could actually produce it.  2^32 - 1 means a value pulseaudio literally considers invalid.

[3] In reality, while the sound card volume steps down by .90 dB for each 1%, rather than actually output at -90 dB the volume is muted to -\infty at 0%.  Also, pulseaudio treats -200 dB as -\infty for certain conversion purposes.  Also note that there are some theoretical roundoff issues, but those are not the problem here, except so far as they make the numbers displayed to the user slightly off by rounding to whole number percentages.

Comment 21 John Thacker 2009-09-27 06:04:11 UTC
NB:  Lennart, if I understand correctly, according to your documentation the maximum sound value we can store is UINT32_MAX - 2, when UINT16_MAX + 1 represents 0 dB and 0 basically represents -90 dB on my card. That means that any app can store a volume of say, 289 dB and pulseaudio is okay with that and will try to send that out to the soundcard and the speakers?  (I see you used a cubic mapping.)

http://0pointer.de/lennart/projects/pulseaudio/doxygen/volume_8h.html

Comment 22 John Thacker 2009-09-27 14:24:32 UTC
So this may be pulseaudio's fault, but a short way of saying what's going on is:

1) rhythmbox volume is remembered by something as "x dB from pulseaudio reference volume before rhythmbox is launched."
2) If the pulseaudio volume before rhythmbox is launched is set to -30 dB, then we can max out the volume inside rhythmbox (which sets the overall flat volume to 0 dB) and quit.  This results in rhythmbox's volume being remembered as "+30 dB from reference," and the reference volume reset to -30 dB.
3) If we raise the main volume to 0 dB and then start rhythmbox, when we start playing a file it sets the main volume to 30 dB over the initial main volume, or 0 dB + 30 dB = 30 dB, and blasts our ears.

Comment 23 Luke 2009-10-03 15:36:55 UTC
Right, the volume either drops to 0% (Rhythmbox and Pulseaudio volumes seem to be linked, removing that finer control from... the previous dozen versions that worked just fine) or boosts up to obscene levels. Either way, I can't listen to my music without risking damaging my ears or upsetting my roommates... when it plays. This is an embarrassment to me personally (when I'm just trying to play music for myself or friends and I start yelling at the PC that has a mind of its own) and on Linux itself; this may be the only exposure to Linux some people get, and they see my frustration.

Comment 24 Luke 2009-10-03 15:45:04 UTC
Why does moving the volume slider in a Gstreamer application from 0% to 2% change the output from inaudible to deafening? Lennart Poettering, do you know what it takes to get me on Bugzilla at 7 AM?

Comment 25 John Thacker 2009-10-03 18:46:50 UTC
"Why does moving the volume slider in a Gstreamer application from 0% to 2%
change the output from inaudible to deafening?"

Check your speaker levels and turn them down, way down, first. 0% is always mute, and that doesn't say *anything* about how loud 1% and 2% are.

The volume scale used by pulseaudio as displayed by most apps is a linear scale in dB.  For the case of my on-board audio, that means that 100% is 0 dB, and it steps down by .9 dB for each 1% on the mixer, until it reaches -89.1 dB at 1%.
It would be -90 dB at 0%, but pulseaudio always overrides 0% with mute (-\infty dB).  This is partially because of the logarithms involved in unit conversion, and partially because people expect 0% to be mute, not "the softest that the sound card can scale down the volume to."

What that means is that 1% and 2%, while proportionately related to each other by dB, can be based off any arbitrarily higher volume than 0%.

Second, you should be aware that since pulseaudio represents volume in linear dB, it is *NOT* the case that 100% will sound twice as loud as 50%, which sounds twice as loud as 25%.  As I mentioned above, to the human ear an additive change of about 6 to 10 dB sounds like being twice as loud.  That means that on my card, 100% is twice as loud as 90% is twice as loud as 80% is twice as loud as 70%, and so on.

Comment 26 Luke 2009-10-04 20:00:34 UTC
Are unpowered headphones low enough? 0% is not mute in Rhythmbox. There is sound, but it is unintelligible; "inaudible" was the wrong word. However, "deafening" is not the wrong word for 2%, which is the next click up. Changing the volume in Rhythmbox (or Totem, or any Gstreamer app) also changes the Pulse master volume, greatly reducing the control I have over the volume settings. I read your previous email regarding the logarithmic vs linear scaling, and I understood it. Great. I mean, really, truly great... I theoretically have finer grained control over how loud my audio is. In practice, "the volume goes crazy sometimes." I have seen other bugs reporting that there are little tricks to changing the master volume and Gstreamer volumes separately, but I don't want to do some crazy dance to find the middle ground between unintelligible and deafening. All the worse if I have to do that dance every other song because Pulse has decided of its own accord to switch the levels because a new song is playing.

Comment 27 Christopher Beland 2009-10-13 21:27:14 UTC
I, too, have thrown my headphones across the room after being blasted with painful amounts of noise.  As it happens, it was with Audacious.

I noticed something today which may be contributing to the problem.  I have an audio stream paused in Firefox, and an MP3 playing in Audacious.  When I adjust the master PulseAudio volume from the desktop, the levels for both Firefox and Audacious in Sound Preferences also go up and down.  But the volume level on the main Audacious window does *not* move.  If I turn down the desktop volume but then go to adjust the level using the Audacious window, the volume jumps abruptly back to where it started.

Also, if I move the Audacious slider in Sound Preferences all the way to the left, the Mute checkbox for Audacious activates, but then doesn't de-activate when I move the Audacious slider back to the right.  This does not happen if I do the same thing using the slider in the Audacious window itself.

Comment 28 Lennart Poettering 2009-10-14 14:25:33 UTC
Christopher, that looks more like an issue in Audacious then in PA.

Comment 29 Kiwon Um 2009-10-16 07:20:04 UTC
I'm now suffering from the exactly same problem... One more comment...

When I use Audacious, sometime its volume goes down (very low), and just after moving the volume slide-bar on it, the sound immediately comes back into the fine level.

This is a very urgent bug... urgent sound blasting.

Comment 30 Lennart Poettering 2009-10-17 01:00:01 UTC
Ok, the original gst prob is actually the same as bug 488532. Closing as duplicate hence.

*** This bug has been marked as a duplicate of bug 488532 ***

Comment 31 Christopher Beland 2009-10-18 01:23:10 UTC
OK, thanks for the diagnosis.  Audacious internal problem reported as Bug 529518, mute checkbox problem reported as Bug 529519.

Comment 32 Germano Massullo 2009-11-04 21:41:13 UTC
(In reply to comment #30)
> Ok, the original gst prob is actually the same as bug 488532. Closing as
> duplicate hence.
> 
> *** This bug has been marked as a duplicate of 488532 ***  

Wrong! This is the most correct bug report's name because it does not affects only totem