Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Volume level: 1% must be equal const db #2111

Closed
Clementine-Issue-Importer opened this issue Dec 9, 2013 · 0 comments
Closed

Volume level: 1% must be equal const db #2111

Clementine-Issue-Importer opened this issue Dec 9, 2013 · 0 comments

Comments

@Clementine-Issue-Importer

From andrew.gaydenko on July 29, 2011 12:14:08

This (sometimes funny) discussion can be used as intriduction to a problem: https://bugs.kde.org/show_bug.cgi?id=195556 It is good current volume (as function of percents) is near linear - I have attached a graph. But there is two issues:

  1. It isn't strictly linear (but must),
  2. Slope is too small.

With cuttent slope we, in fact, have not any volume control for low levels. Another consequence is: we forced to have rather big mouse wheel step (4%).

I suggest strict 1% == 0.5 db law, and with such curve optimal wheel step will be 2% (1db - approximately the same step as now with 4%).

I'm sure gst has API for linear volume setting (i.e., say, in range 0.0..1.0 volume 0.5 corresponds to -6.02db), so it will be one-line fixing of the problem (and next line to change wheel step to 2%).

Attachment: ClementineVolumeGraph.png

Original issue: http://code.google.com/p/clementine-player/issues/detail?id=2111

@Clementine-Issue-Importer
Copy link
Author

From andrew.gaydenko on July 29, 2011 08:06:31

In fact, I just have tried tiny code modification (and am happy with it). Modified methods are:

uint Engine::Base::MakeVolumeLogarithmic(uint volume) {
return volume;
}

void MainWindow::VolumeWheelEvent(int delta) {
ui_->volume->setValue(ui_->volume->value() + delta / 60);
}

void
Amarok::VolumeSlider::wheelEvent( QWheelEvent *e )
{
const uint step = e->delta() / 60;
QSlider::setValue( QSlider::value() + step );

emit sliderReleased( value() );

}

void GstEnginePipeline::UpdateVolume() {

float vol = 0.0;
if (volume_percent_ <= 0)
vol = 0.0;
else if (volume_percent_ >= 100)
vol = 1.0;
else {
float db = float(volume_percent_ - 100) / 2.0;
vol = pow(10.0, db / 20.0);
}

g_object_set(G_OBJECT(volume_), "volume", vol * volume_modifier_, NULL);
}

I don't know cpp, qt, gst, g_object and so on, as well as the player code in a whole, but it works ;)

As you see, small design shift in mind is needed: we must deal with level in float space only rather in integer space (percents).

@Clementine-Issue-Importer
Copy link
Author

From john.maguire on August 04, 2011 07:44:23

Summary: Volume level: 1% must be equal const db
Labels: -Priority-Medium Priority-Low Component-Sound

@Clementine-Issue-Importer
Copy link
Author

From andrew.gaydenko on August 19, 2011 17:11:15

I'm not sure the attached patch is correct as far as have never prepared multifile patches - this is the first one :-) It is prepared against src directory.

Attachment: volDb01.patch

@Clementine-Issue-Importer
Copy link
Author

From arnaud.bienner on August 22, 2011 23:33:41

Labels: PatchAttached

@Clementine-Issue-Importer
Copy link
Author

From davidsansome on August 26, 2011 14:46:21

Sorry it's taken me a while to look at the patch - it's been a busy week!
Maybe I don't understand what you're trying to do here, but I was under the impression that logarithmic volume controls were better suited to human hearing than linear ones. With your patch, reducing the volume to 50% makes it sound far quieter than what my intuition would tell me was "half as loud".

@Clementine-Issue-Importer
Copy link
Author

From andrew.gaydenko on August 26, 2011 15:42:59

Sorry it's taken me a while to look at the patch - it's been a busy week!

David, you have no any obligations at all in current context. Thanks for your efforts! At any case and forever users wants more rather developers can :)

Maybe I don't understand what you're trying to do here, but I was under the impression that logarithmic volume controls were better suited to human hearing than linear ones.

Exactly! - I even can predict few upcoming thousands of years this ears' property will not change :)

With your patch, reducing the volume to 50% makes it sound far quieter than what my intuition would tell me was "half as loud".

No-no, here we haven't any sense of linearity. Strictly speaking a scale is infinite as far as level 0.0 corresponds to -inf in decibels scale. So a step (in db) is selecting just from practical experience, and last step is infinite also, say:
...
2% -49.0db
1% -49.5db
0% -inf db

Two aspects must be considered:

  1. Step must not be too small to have any acoustic sense. Currently it is 1% ~ 0.25db (see image above), and it is too narrow for our ears to clearly differentiate this step (I don't say it is impossible, but isn't useful).
  2. We must select overall regulating range. Ranges as 40-60db are common selection.

I suggest 50db range (rather, say, 40 or 60) as far as we use percents - at this case we just have simple 1:2 relation which is very handy for those of us who are burdened with all these nuances :)

The picture also demonstrates why we must use float rather integer operation - a curve isn't straight line because of rounding errors.

@Clementine-Issue-Importer
Copy link
Author

From andrew.gaydenko on September 16, 2011 08:57:22

David,

Must I supply additional comments to the issue/patch?

@Clementine-Issue-Importer
Copy link
Author

From andrew.gaydenko on November 25, 2011 13:15:22

David,

Is my understanding correct, you have decided to postpone the patch applying until 1.0?

@Clementine-Issue-Importer
Copy link
Author

From davidsansome on November 27, 2011 08:17:58

Hmm, I'm still not convinced this is the right thing to do. I'm sure your patch makes the volume control technically more accurate but the current implementation still sounds better to me.

Status: WontFix

@Clementine-Issue-Importer
Copy link
Author

From andrew.gaydenko on November 27, 2011 08:46:33

There is some irony: small players (Aqualung, DeadBeef) strictly follow world-wide multi-decades conventions, while big applications (A2, and now - pity of it!! - Clementine) don't...

I have used the patch four months now, and am ready to continue to do :-) But - if some little chance still exists - what is that exact feeling why current implementation is better for you? I'm ready to modify the patch.

@Clementine-Issue-Importer
Copy link
Author

From andrew.gaydenko on November 27, 2011 11:57:36

...Say, as a point of consensus, we can set 1 db to be strictly equal to 3% - at this case regulation curve will be very close to current one - look at the picture attached to the first message (but will be a straight line and, OTOH, relation percent/db == 3/1 will also be evident). As I have already mentioned, the relation itself isn't too important. For such short volume regulator (as an Amarok 1.4 inheritance) percent/db == 2/1 steepness can be indeed too sharp, if it is that inconvenience you are taking in mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant