Rockbox Technical Forums

Rockbox General => Rockbox General Discussion => Topic started by: terrence1019 on May 17, 2008, 03:42:22 AM

Title: Volume Limiter
Post by: terrence1019 on May 17, 2008, 03:42:22 AM
If know there has been talks of inserting a volume limiting function (a la iPod) and that the prospect of inserting it into SVN code is low.

What if I were to make a volume limiting plugin? Would that be more preferably accepted?
Title: Re: Volume Limiter
Post by: Llorean on May 17, 2008, 03:57:11 AM
I'm not sure I understand at all what you're proposing. How would it work? How would it offer any benefit over simply changing the volume? Or setting a pre-amp to limit the volume? Or replaygaining your files to limit maximum effective loudness?
Title: Re: Volume Limiter
Post by: markun on May 17, 2008, 05:10:08 AM
yes, it should be possible as a plugin as well, but since you can't do that much when the plugin is running it would not be so nice.

Would you want your limiter also to raise the volume when the music gets too quiet, or only to limit the volume during loud parts?
Title: Re: Volume Limiter
Post by: dreamlayers on May 17, 2008, 12:01:16 PM
I'm not sure I understand at all what you're proposing. How would it work? How would it offer any benefit over simply changing the volume? Or setting a pre-amp to limit the volume? Or replaygaining your files to limit maximum effective loudness?

Don't those scale the digital value, effectively decreasing the number of DAC bits in use, increasing distortion from that and decreasing signal to noise ratio?

I think only the volume actually scales the analog output of the DAC, allowing the full range of the DAC to be used. 

I think a volume limit option might help avoid times when while turning up the volume one overshoots into uncomfortable volume and it could help avoid volume levels which result in distortion.
Title: Re: Volume Limiter
Post by: Mad Cow on May 17, 2008, 02:45:36 PM
On the ipod OF, it's just a limit on how loud you can set it. So say you don't want it to go over -10db, you set it at that and the volume would never go over that. I never really understaood the point of it though.
Title: Re: Volume Limiter
Post by: terrence1019 on May 18, 2008, 01:13:32 AM
yes, it should be possible as a plugin as well, but since you can't do that much when the plugin is running it would not be so nice.

Would you want your limiter also to raise the volume when the music gets too quiet, or only to limit the volume during loud parts?

Simply, it just limits the volume to a certain maximum limit.

Example: setting -3 db as a limit

I want it to be like iPod's volume control limit
Title: Re: Volume Limiter
Post by: markun on May 18, 2008, 05:21:53 AM
So you want to limit the value of the volume setting, not the actual volume itself (which also depends on the audio file being played) ? Can you explain In which cases that would be useful?

Also, I don't see how that could be done with a plugin...
Title: Re: Volume Limiter
Post by: terrence1019 on May 18, 2008, 11:10:10 AM
So you want to limit the value of the volume setting, not the actual volume itself (which also depends on the audio file being played) ? Can you explain In which cases that would be useful?

Also, I don't see how that could be done with a plugin...

It would be useful for those who always wanted this as a setting.

But seeing it can't be done as a plugin, I'll abandon the project.
Title: Re: Volume Limiter
Post by: linuxstb on May 18, 2008, 11:23:48 AM
Just because a feature isn't wanted in the official Rockbox code, doesn't mean you shouldn't implement it for your own pleasure...
Title: Re: Volume Limiter
Post by: saratoga on May 18, 2008, 02:06:42 PM
So you want to limit the value of the volume setting, not the actual volume itself (which also depends on the audio file being played) ? Can you explain In which cases that would be useful?

Also, I don't see how that could be done with a plugin...

It would be useful for those who always wanted this as a setting.


Couldn't you just not raise the volume above whatever level you want as the limit?  Having an option who's sole purpose is to change the range of values on another option is pretty silly IMO. 
Title: Re: Volume Limiter
Post by: spike66 on May 18, 2008, 05:31:28 PM
It is said that prolonged listening to certain volume levels can cause hearing damage. While the *recommended* max volume level is 70dB, most DAPs can go up to 100dB, so maybe it's not such a bad idea to have the option to put limits on that, just because it might be difficult to manually do it in certain occasions.  It is kind of hard sometimes to identify that limit level for instance. I personally have the tendency to “get carried away” during some songs and put the volume really loud :D; it also happens when the environment is noisy, you tend to raise the volume level in order to hear the music, making your ears go through a much higher decibel level.

Apple's OF is far from perfect though, because it is not a real limit to the decibel level, but rather a "volume set limit", so e.g. if you are listening to a song at an adequate level -volume limit on- but the next song is twice as loud, you'll just hear it twice as loud… it has to be used together with replaygain I guess. They are apparently thinking of making a further change there, check http://www.allheadlinenews.com/articles/7009538792
Title: Re: Volume Limiter
Post by: eevan on May 18, 2008, 06:09:30 PM
I have an old Sony discman that has AVLS (automatic volume level system). It works like a limiter with a very long release time and properly adjusted threshold level. You can use the volume pot but when you reach a certain level the volume remains constant even if you crank it to the max. Also, it has very short attack time. You can turn the pot quickly to the max, but you barely notice the change in volume.

Maybe the OP had something like that in mind.
Title: Re: Volume Limiter
Post by: Llorean on May 18, 2008, 06:10:21 PM
Frankly this is mostly marketing fluff. How loud the audio is depends not only on what it's mastered at, but also on the sensitivity of your headphones. Many listeners also use an amp which changes things further.

There is no way to know how loud you're listening from the player's side. All you can do is replaygain your music, then attempt to choose a level you feel is comfortable with your headphones, or take careful measurement with them. Then, never turn the volume above this level.

A volume limiting plugin would be misleading since it can't be any more precise than a user simply choosing not to turn up the volume. The only way it could be effective is if it weren't controllable by a user and were capped at an extremely cautious level. Any user who can say "It's too loud to hear my music here so I'll turn it up" can also say "It's too loud to hear my music here, so I'll turn off the limit, just for a little while, so I can turn it up." You aren't taking that choice out of their hands, so it really offers no protection beyond their own decisions.

And even then, as I've said a few times now, an equalizer precut serves this exact purpose anyway (limiting the effective maximum volume).
Title: Re: Volume Limiter
Post by: soap on May 18, 2008, 06:36:22 PM
A method to prevent hearing damage would have to limit decibels to your eardrum.  The power delivered by your DAP's amp is just one part of the equation which determines this value.

In theory your DAP could monitor the energy level of the final signal before it enters the amplifier, and decrease the volume if found to be over a user-set limit - but here is where it gets tricky. 
What I just described limits the electrical energy leaving the DAP - but this has a relatively weak relationship to the mechanical energy delivered to your eardrums.

The efficiency of your headphones is a large factor (as Llorean mentioned) but also the physical fit of the headphones to your ear, and the nature of the air gap between (volume, shape, freedom of movement) the headphone drivers and your eardrum is also a very significant factor.  This is why your would be unable to create a lookup table for headphones and say "Headphones A deliver X decibels of energy to my eardrums when given Y watts of electrical power."
Unless you have a decently accurate model of your head, your ear canal, and your outer ear you simply can not solve this equation to a level of confidence which would deliver safety.


I'm not sure I understand at all what you're proposing. How would it work? How would it offer any benefit over simply changing the volume? Or setting a pre-amp to limit the volume? Or replaygaining your files to limit maximum effective loudness?

Don't those scale the digital value, effectively decreasing the number of DAC bits in use, increasing distortion from that and decreasing signal to noise ratio?
Decreasing the digital value does decrease the number of bits in use, but does not increase distortion - simply decreases the signal to noise ratio.  And considering you only want to deliver 70-80 decibels to your ear, and the background noise of a quiet room is 20 or so.....
Title: Re: Volume Limiter
Post by: saratoga on May 19, 2008, 01:29:14 AM
It is said that prolonged listening to certain volume levels can cause hearing damage. While the *recommended* max volume level is 70dB, most DAPs can go up to 100dB, so maybe it's not such a bad idea to have the option to put limits on that, just because it might be difficult to manually do it in certain occasions. 

Its not actually possible to limit the dB at your ear, since that depends on the headphones used.  The most you can do is limit the power at the amp, and we have that already (volume control).
Title: Re: Volume Limiter
Post by: gevaerts on May 20, 2008, 10:16:48 AM
I think there is one case where a configurable limit would be useful : if you increase the volume without looking at it, and you are in a quiet part, it's easy to set it higher than you would if you look at the screen at the same time.
Title: Re: Volume Limiter
Post by: yapper on May 20, 2008, 12:17:12 PM
With targets that support gain settings above 0dB, it would be nice to cap the gain at 0dB.
Title: Re: Volume Limiter
Post by: soap on May 20, 2008, 11:13:22 PM
With targets that support gain settings above 0dB, it would be nice to cap the gain at 0dB.
I think there is one case where a configurable limit would be useful : if you increase the volume without looking at it, and you are in a quiet part, it's easy to set it higher than you would if you look at the screen at the same time.
How does setting the EQ preamp to a negative value not address these two issues?
Title: Re: Volume Limiter
Post by: yapper on May 22, 2008, 09:49:26 PM
Neat - if I hadn't mistakenly set precut to -3dB instead of -6dB it would have worked the first time I tried it  :)

The only slightly confusing thing is that the WPS volume display still shows the gain setting without taking into account the precut (e.g. on my 2G ipod at full gain, it shows +6dB, despite the precut of -6dB). Ditto for the Sound Settings->Volume menu. However I can live with that.
Title: Re: Volume Limiter
Post by: shoe on May 23, 2008, 01:39:08 PM
There was an earlier thread I read in the forums about volume limiting.  After reading it, I created a fixed.cfg folder in the .rockbox directory, with the following text:
    eq enabled: on
    eq precut: 240
This guarantees the player will be volume limited every time it is powered on.  I also put:
    volume: -30
in the file, so that it always powers on at the same volume (does not remember volume when turned it off).
Title: Re: Volume Limiter
Post by: zuvembi on October 23, 2008, 12:45:00 PM
I think there is one case where a configurable limit would be useful : if you increase the volume without looking at it, and you are in a quiet part, it's easy to set it higher than you would if you look at the screen at the same time.
This is precisely the reason I'd like to have it.  I have podcasts I listen to on my e250 on the way to work (while I'm on my bicycle).  Sometimes I turn it up (through my vest), so I can't pull it out and look to see how high it is.  I'd like to limit the amount I can raise it. 

I mean, if it's a setting, I can always go back and change it if I need to.
Title: Re: Volume Limiter
Post by: shoe on October 23, 2008, 01:12:43 PM
Sometimes I turn it up (through my vest), so I can't pull it out and look to see how high it is.  I'd like to limit the amount I can raise it.  I mean, if it's a setting, I can always go back and change it if I need to.
There is already a setting for this, as mentioned above, it is the equalizer precut.
Title: Re: Volume Limiter
Post by: NorTheBear on October 24, 2008, 10:21:52 AM
What about this real world scenario:
- In the evening you connect your DAP to your stereo receiver or active loudspeakers and set the volume on your DAP at highest level
- Next morning you forget to rule down the volume before you put on your earphones and then it will really hurt (believe me or try it out yourself :-)

I am throwing this into discussion because I see at least three aspects of controlling the volume:
First, set the volume to a configurable maximum level so that you can't exceed that value by mistake if you are playing around with the volume control buttons (original poster's inquiry)
Second, allowing me to have a kind of "LINE OUT" mode that supplies a strong signal (max volume) to the amplifier of my stereo device.
Third, avoiding any physiological ear damages even if you have forgotten to reset the volume to a 'normal' level. I can think of a configurable start level after booting the firmware.

Just my 20 cents.

Cheers, Norbert.






Title: Re: Volume Limiter
Post by: Febs on October 24, 2008, 10:38:05 AM
What about this real world scenario:
- In the evening you connect your DAP to your stereo receiver or active loudspeakers and set the volume on your DAP at highest level
- Next morning you forget to rule down the volume before you put on your earphones and then it will really hurt (believe me or try it out yourself :-)

I am throwing this into discussion because I see at least three aspects of controlling the volume:
First, set the volume to a configurable maximum level so that you can't exceed that value by mistake if you are playing around with the volume control buttons (original poster's inquiry)

You can do this by using the equalizer pre-cut.  Shoe's post three above yours explains how to put these settings into the fixed.cfg file if you want this to be the default whenever you start Rockbox.

Quote
Second, allowing me to have a kind of "LINE OUT" mode that supplies a strong signal (max volume) to the amplifier of my stereo device.

You can do this by creating a .cfg file with whatever settings you want to use when you connect via line out and then simply loading that .cfg file when you use the line out.

Quote
Third, avoiding any physiological ear damages even if you have forgotten to reset the volume to a 'normal' level. I can think of a configurable start level after booting the firmware.

Again, you can do this by putting a volume setting into your fixed.cfg file.
Title: Re: Volume Limiter
Post by: nloewen on October 25, 2008, 02:05:08 PM
When I bought my headphones, in the manual it had a maximum number of Hertz (mabey something else) that they could handle. could you set a limmit on that?
Title: Re: Volume Limiter
Post by: saratoga on October 25, 2008, 03:46:14 PM
When I bought my headphones, in the manual it had a maximum number of Hertz (mabey something else) that they could handle. could you set a limmit on that?

You can use the EQ to adjust the frequency response in rockbox.  That said, the number that came with your headphones is meaningless.
Title: Re: Volume Limiter
Post by: NorTheBear on October 27, 2008, 10:19:37 AM
NorTheBear:
Quote
Third, avoiding any physiological ear damages even if you have forgotten to reset the volume to a 'normal' level. I can think of a configurable start level after booting the firmware.

Febs:
Quote
Again, you can do this by putting a volume setting into your fixed.cfg file.

Febs, many thanks for your suggestions but I am not too sure how a .cfg file would help if I completely forgot that the volume level is at maximum. I don't want to run a .cfg file each time I use the DAP. Am I missing something?

Again: A moderate volume start level (let's say 20 on a range from 0-40) can easily be adjusted when hearing the first tunes of a song. But from a hearing damage you'd suffer a life time. And for those who just doesn't mind the start level can be set to "last used".

Best, Norbert.
Title: Re: Volume Limiter
Post by: GodEater on October 27, 2008, 10:46:05 AM
fixed.cfg is run everytime you start your DAP whether you like it or not - so having the setting in there acheives precisely what you want from what I can see.
Title: Re: Volume Limiter
Post by: NorTheBear on October 27, 2008, 11:34:25 AM
Dear Feb & GodEater: You are absolutely right! The default fixed.cfg satisfies my needs. Mea culpa! I should have read the manual more carefully next time. Please accept my apologies.
Title: Re: Volume Limiter
Post by: GodEater on October 27, 2008, 11:51:19 AM
No problem - glad you've seen the light now ;)