Better (non-linear) volume control

Bug #204898 reported by Fred on 2008-03-21
78
This bug affects 13 people
Affects Status Importance Assigned to Milestone
alsa-lib (Ubuntu)
Wishlist
Unassigned
Declined for Intrepid by Robbie Williamson
asmix (Ubuntu)
Undecided
Unassigned
Declined for Intrepid by Robbie Williamson
awn-extras (Ubuntu)
Undecided
Unassigned
Declined for Intrepid by Robbie Williamson
gamix (Ubuntu)
Undecided
Unassigned
Declined for Intrepid by Robbie Williamson
gnome-alsamixer (Ubuntu)
Undecided
Unassigned
Declined for Intrepid by Robbie Williamson
libaudio-mixer-perl (Ubuntu)
Undecided
Unassigned
Declined for Intrepid by Robbie Williamson
libgtk2-ex-volumebutton-perl (Ubuntu)
Undecided
Unassigned
Declined for Intrepid by Robbie Williamson
pavucontrol (Ubuntu)
Undecided
Unassigned
Declined for Intrepid by Robbie Williamson
pulseaudio (Ubuntu)
Undecided
Unassigned
Declined for Intrepid by Robbie Williamson
volumecontrol.app (Ubuntu)
Undecided
Unassigned
Declined for Intrepid by Robbie Williamson
wmix (Ubuntu)
Undecided
Unassigned
Declined for Intrepid by Robbie Williamson

Bug Description

I'm not sure if this is fixed by using PulseAudio but I find the volume control in GNOME is way too linear.

Because of this the user has very little control with extreme loud and quiet volumes.
For example, when reducing the volume it will decrease to a certain level then suddenly just go silent.

Much more control would be given with a logarithmic scale.

This page explains it much better: http://sound.westhost.com/project01.htm

the d0ct0r (the-d0ct0r) wrote :

Well, this is going to be my first 'bug'. I agree with you that the volume control is a bit too linear, so I chose this 'bug'. I am working on it.

d0c

Fred (eldmannen+launchpad) wrote :

Awesome that you are working it!
Great dude!

Oguz Yarimtepe (oguzy) wrote :

I would like to learn the process of the bug fix, because i have the same bug also. When are you planning to release the fix?

the d0ct0r (the-d0ct0r) wrote :

Sorry, I almost forgot this bug. I am really busy by now, but I can make some time saturday or so. As soon as possible. Thanks for notifying me.

Enrico Gueli (e-gueli) wrote :

This bug affects me too, with an Intel HDA chip (chipset GM965 / ICH8).

Robbie Williamson (robbiew) wrote :

We plan to discuss a solution for this problem at the Karmic UDS. Please see the foundations-audio blueprint.

Robbie Williamson (robbiew) wrote :

Sorry, the blueprint is foundations-karmic-audio:
  https://blueprints.launchpad.net/ubuntu/+spec/foundations-karmic-audio

Paul Swanson (paul-swanson) wrote :

The above link is no longer valid ... perhaps the following link is more correct:

https://blueprints.launchpad.net/ubuntu/+spec/desktop-karmic-audio-experience

I've raised a question about this, but no responses yet:

https://answers.launchpad.net/alsa-tools/+question/73623

This really needs to be elevated to a priority fix. Having linear volume control is not only frustrating but also, frankly, embarrassing. It really shows that the developers working on the audio system don't actually understand audio that well.

I know that's a fairly strong statement to make, but I stand by it. Logarithmic volume attenuation is electrical engineering 101 type stuff, really basic & fundamental. I think I can speak for many Ubuntu users when I say, I can live with bugs for a time but bad design I cannot tolerate.

Rant aside, is there something I can do to help?

xtknight (xt-knight) wrote :

Here's a debdiff for karmic that enables *EXTREMELY EXPERIMENTAL* support for a logarithmic volume control. I warned you there.

Honestly it was pretty easy (so easy it's deceptive) but I don't know if it works perfectly. I haven't been able to try it on a card with a negative volume lower bound. e.g., in 'amixer -c 0' (for card 0), you'll see this:

  Limits: Playback 0 - 39

My code supports a negative lower bound (less than 0), but I don't know if that ever happens. Consider this a proof of concept. It should be tested a lot more until it's in the code base.

I attached a graph of how it works. The straight line y=x is how alsa is now. The other plot is how alsa will respond with the logarithmic scale with setting 0.7. More sensitivity on the upper end. Debdiff and ppa will come in a second.

xtknight (xt-knight) wrote :

Test master/pcm channels with alsamixer. I have no idea if it works with PulseAudio correctly.

Mário Buči (mario-buci) wrote :

Thanks for the patch xtknight.. but i can't hear any difference. Maybe it's cause of pulseaudio, I'm not sure. Could you try to make it more curved? So the difference would be more obvious. The sound is almost muted till I reach 50%..

xtknight (xt-knight) wrote :

Hey Mario,

Have you tried with alsamixer?

I did try making it 0.2 (instead of 0.7) actually earlier on but this seems to move the problem to the bottom end of the volume control. I'm not sure if what I'm doing is the correct way to do it but there is a difference with alsa mixer. I seem to have more luck with the Master channel than the PCM one but a short check inside the code told me the PCM one was working. I haven't been able to confirm anything though and I'll continue doing some testing.

Mário Buči (mario-buci) wrote :

I tried alsamixer, both channels (main, pcm), but with pulseaudio running.. maybe if i quit pulseaudio, it would work. Oh, and I'm running Jaunty with your packages for karmic koala.. this could be a problem, too, right?

I'm not really good example of beta tester :D

xtknight (xt-knight) wrote :

Hey Mario,

I'm not sure, but Karmic packages on Jaunty should work.

Anyway, I took measurements with a sound meter and my headphones. I think we're just migrating the problem. Alsa is already a dB scale. This patch maybe makes it more linear to the ears. I don't know enough about sound to say for sure.

It works, but needs some tuning or a more advanced algorithm.

With patch:

Varying master:
16: 53dbC
19: 54dbC
23: 56dbC
26: 57dbC
29: 59dbC
32: 61dbC
35: 62dbC
39: 64dbC
42: 66dbC
45: 67dbC
48: 69dbC
55: 71dbC
58: 73dbC
61: 75dbC
65: 77dbC
71: 79dbC
74: 80dbC
77: 83dbC
81: 85dbC
84: 85dbC
87: 87dbC
90: 87dbC
94: 87dbC
97: 87dbC
100: 87dbC

Without patch:

26: 52dbC
29: 53dbC
32: 54dbC
35: 56dbC
39: 57dbC
42: 59dbC
45: 61dbC
48: 62dbC
52: 64dbC
55: 66dbC
58: 68dbC
61: 69dbC
65: 71dbC
68: 72dbC
71: 74dbC
74: 76dbC
77: 78dbC
81: 80dbC
84: 82dbC
87: 84dbC
90: 86dbC
94: 86dbC
97: 86dbC
100: 86dbC

xtknight (xt-knight) wrote :

Try my new ppa (ubuntu4~ppa1): https://launchpad.net/~xt-knight/+archive/ppa

Plus, set Master to 100% and adjust PCM. This is a better method, because Master goes from 0-31 and PCM goes from 0-255, at least on most cards. PCM is a higher resolution adjustment. It works with PulseAudio in my experience. I think PulseAudio adjusts through ALSA anyway. This is why I made the change at such a low level. The constant is now 0.5 instead of 0.7.

Don't use PulseAudio's volume control in pavucontrol. I think there's other serious bugs in that right now, at least in Karmic. Use alsamixer under the terminal and set Master to 100%, adjust PCM. Sometimes you have to press the down or up arrow multiple times simply because all the volumes you adjusted to map to the same volume. Or maybe it's a rounding issue.

dB gain readings may be broken with this patch. It should be able to be fixed easily.

Nigel Babu (nigelbabu) wrote :

This bug was reported quite a while back. Can anyone confirm if the bug was fixed or is still outstanding?

affects: ubuntu → alsa-lib (Ubuntu)
Changed in alsa-lib (Ubuntu):
status: In Progress → Incomplete
Daniel T Chen (crimsun) wrote :

Please note that this solution is much more involved; the driver, library, and pulseaudio all need to be aware of this information. Currently the most broken point is in the drivers; we need to fix that point first.

Daniel T Chen (crimsun) on 2011-10-10
Changed in alsa-lib (Ubuntu):
importance: Undecided → Wishlist
status: Incomplete → Opinion
no longer affects: kdemultimedia (Ubuntu)
Thomas Hotz (thotz) on 2013-06-10
Changed in alsa-lib (Ubuntu):
assignee: the d0ct0r (the-d0ct0r) → nobody
status: Opinion → Confirmed
Thomas Hotz (thotz) on 2013-06-10
Changed in alsa-lib (Ubuntu):
status: Confirmed → Opinion
Thomas Hotz (thotz) on 2013-06-12
Changed in asmix (Ubuntu):
status: New → Opinion
Changed in wmix (Ubuntu):
status: New → Opinion
Changed in volumecontrol.app (Ubuntu):
status: New → Opinion
Changed in pavucontrol (Ubuntu):
status: New → Opinion
Changed in libgtk2-ex-volumebutton-perl (Ubuntu):
status: New → Opinion
Changed in libaudio-mixer-perl (Ubuntu):
status: New → Opinion
Changed in gnome-alsamixer (Ubuntu):
status: New → Opinion
Changed in gamix (Ubuntu):
status: New → Opinion
Changed in awn-extras (Ubuntu):
status: New → Opinion
Changed in pulseaudio (Ubuntu):
status: New → Opinion
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers