Rockbox

Tasklist

FS#12568 - iPod Classic - limit volume to +6db

Attached to Project: Rockbox
Opened by Albert Barca (axismundi) - Sunday, 29 January 2012, 15:27 GMT
Task Type Patches
Category Configuration
Status Unconfirmed
Assigned To No-one
Operating System Another
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

The iPod Classic Cirrus CS42L55 DAC+amp chip is specified to output audio up to +12dB versus the reference level (0.775V RMS) and the current Rockbox driver implements this accordingly (note that the OF limits the amplification to a lower level).

However, any amplification above +3dB applied to a 0dB signal results in serious clipping errors, the sound being distorted (oscilloscope measurements attached). This is not a surprise, given that +12dB translates in over 8V peak-to-peak output, way above what the iPod is capable of with its 3.7V battery.

Distortions aside, +12dB can be overkill for most of the earphones (depending on the sensitivity) and not a very pleasant experience. If you put the iPod in your pocket and forget to lock it you may experience this frequently.

In practice not all tracks have peaks reaching the 0dB level (actually nowadays this is quite common given the "loudness war"). To provide some room for additional amplification when needed, I found the +6dB limit to be a good compromise.
This task depends upon

Comment by Bertrik Sikken (bertrik) - Sunday, 29 January 2012, 18:17 GMT
Now this is useful data, nice job collecting this.

What rockbox considers "0 dB" has no relation to the absolute voltage, but simply means the highest level that can be played back without clipping (AFAIK).
So perhaps the level have to be shifted a bit, so 3 dB(ref) becomes 0 dB (rockbox).
If the user puts the volume above 0 dB, it's their own responsibility.
Comment by Albert Barca (axismundi) - Sunday, 29 January 2012, 22:01 GMT
I'm definitely not the specialist here, but I believe that the amplification levels in Rockbox are linked to the DAC+chip combo specifications. I doubt there is a practical way to easily detect the clipping level for each target and set that level to be the reference (0dB).

If the chip manufacturer follows the norm in the digital audio domain, 0dB (more precisely 0dBu) means 0.775V and this seems to have been the case at least with the CS42L55. The clipping levels will vary depending on the target, but it will not necessarily always be 0dBu (albeit this can probably be a good approximation). The whole dB subject can be discussed extensively given that in essence the dB scales measures the ratio between two levels, in other words it is a relative scale.

Shifting the volume scale is actually not a bad idea, it would be like having as a reference the dBFS (full scale) and not the dBu. Still I'm not sure that it will bring much benefit and most likely would not be consistent with how the volume scale is defined for other targets. Note also that many reputable manufacturers of audio equipment have products with an amplification scale that goes beyond 0dB without distorting.

Indeed, it is the user that decides the settings he adopts (that's the great thing about Rockbox), but definitely the CS42L55 does not benefit from being pushed to +12dB and neither do our ears.

For the ones interested, a good summary of the dB topic in audio can be found at http://www.jimprice.com/prosound/db.htm.
Comment by MichaelGiacomelli (saratoga) - Monday, 30 January 2012, 07:58 GMT
>I doubt there is a practical way to easily detect the clipping level for each target and set that level to be the reference (0dB).

Generally we just use the spec values, and if they seem off, measure it with a tool like RMAA.

>If the chip manufacturer follows the norm in the digital audio domain, 0dB (more precisely 0dBu) means 0.775V and this seems to have been the case at least with the CS42L55.

Its generally 0dB, rather then dBv or similar. Its not referenced to anything absolute, just whatever the max voltage the chip can produce.

Since it seems like we're off by 3dB, you should just shift 0dB up 3 dB so that the maximum volume is now +9 dB.
Comment by Cástor Muñoz (prof_wolfff) - Saturday, 04 February 2012, 05:11 GMT
I haven't used OF but did some measurements before removing it, mine is a 80Gb iPod bought in EU (Germany), looking at these numbers i realize OF was limiting the maximum volumen about -8dB (-11dBFS), another good reason to install Rockbox.


Comment by Seheon Ryu (cpu98) - Saturday, 04 February 2012, 05:34 GMT
Seems it is switching supply rail so when it's running on forced low voltage rail mode, it would clip at +0dB and on forced high voltage rail mode or adaptive mode it would clip at +3dB.
Output characteristics hint +2dB optimal on line load, -4dB optimal on 16ohm load.
I've seen iPod touches clipping with 16ohm load, fine with +24ohm load at max volume.
Comment by Albert Barca (axismundi) - Monday, 06 February 2012, 22:38 GMT
> Since it seems like we're off by 3dB, you should just shift 0dB up 3 dB so that the maximum volume is now +9 dB

I've been thinking this, I like the idea but in the same time I don't know what to say... 3dB off is not that much, it may not hurt to be conservative and leave a small margin (i.e. this way one can be sure that 0dB will not distort). Plus by keeping the current scale we maintain a 1:1 equivalence with the specifications of CS42L55.

If I find some time these days some I'll write a patch to shift the volume range as suggested, maybe some people we'll find it useful. For my use the volume cap is still more valuable, I'll look to see what it takes to add an option in the audio menu that would allow setting an arbitrary volume limit (same principle as in the OF), this way we would keep the best of both worlds.

> Seems it is switching supply rail so when it's running on forced low voltage rail mode, it would clip at +0dB and on forced high voltage rail mode or adaptive mode it would clip at +3dB
>Output characteristics hint +2dB optimal on line load, -4dB optimal on 16ohm load.

Interesting, the testing with the oscilloscope was done with no load indeed. In the same time, a couple of weeks ago I had run a RMAA test with a 16ohms load/0dB; the distortion figure was very small, I doubt there was any significant clipping as you're hinting. I'll play with the oscilloscope a little more when I manage to find a couple of hours for this, I'll post the results.
Comment by MichaelGiacomelli (saratoga) - Monday, 06 February 2012, 22:45 GMT
>I've been thinking this, I like the idea but in the same time I don't know what to say... 3dB off is not that much, it may not hurt to be conservative and leave a small margin

We should not clip at 0dB when feeding a full scale waveform and clip at +1dB. We have a margin, its all the negative volume values :)

>For my use the volume cap is still more valuable, I'll look to see what it takes to add an option in the audio menu that would allow setting an arbitrary volume limit (same principle as in the OF), this way we would keep the best of both worlds.

You can already do this using the preamp. We've discussed this before and decided that we don't want another way to do this so there is no need to post a patch for it.

>Interesting, the testing with the oscilloscope was done with no load indeed.

Distortion will generally be much worse with a load, so the maximum clipping level should be determined using one. Of course the maximum level may depend on the supply voltages, so those should be considered as well. Once its determined, we can set that to 0dB and then people can set the volume, preamp, and replaygain to whatever they want to accomplish their goals.
Comment by Albert Barca (axismundi) - Tuesday, 07 February 2012, 00:11 GMT
> We should not clip at 0dB when feeding a full scale waveform and clip at +1dB. We have a margin, its all the negative volume values :)

That assumes that there is no variation between the players and they all behave the same regardless of the load, setting, battery level (the latter shouldn't have too much influence though). But I like your reply re the margin :-).

If this is how the volume range works on other targets, I'll give it a try. But not before doing more measurements to make sure that 3dB is indeed the more relevant value (on average at least).

> You can already do this using the preamp.
Yes and know. Unless I'm missing something, the precut is applied to the digital signal, i.e. before the volume control in the audio chip. This translates in lower dynamic range and deteriorating S/N ration for each dB of volume cut in the preamp. Maybe not by a huge amount, however I still see the point in implementing a separate limit setting acting directly on the hardware volume. I believe another small disadvantage of the precut solution is that it requires slightly more processing power, which translates in some battery cost (tiny as it may be).
I've been a happy rockbox user for years but editing parts of the code is new to me, so this would also be good homework. But thanks for the heads-up, it's appreciated!

> Distortion will generally be much worse with a load
I'm fully aware of that. Not only the distortion, but also the crosstalk, the frequency response etc. It's just that at the time I made the oscilloscope measurements I was looking at the volume settings limit from a different angle - i.e. I was trying to demonstrate that even under favorable conditions the Classic will clip above +3dB. As the focus is changing, I'll run some more measurements with and without load.

Thanks everyone for your input.

Comment by Albert Barca (axismundi) - Monday, 13 February 2012, 00:58 GMT
I finally found some time to run a few more tests.

First, the OF (Europe) is limited at a level which corresponds to the -8dB setting in Rockbox (good catch, Castor); this translates in roughly 980mVpp from a 0dBFS 1kHz sine wave with no load and 790Vpp with a 16ohms load.

Second, the clipping level in the Classic is heavily dependent on the load. This is not a surprise, yet the degree is higher than I personally expected. As my initial post stated, the clipping threshold with no load is 3dB (corresponding to 3.36Vpp on 1kHz sine wave); with 16ohms load this decreases to 1.32Vpp, i.e. -3dB in Rockbox. Figures shall improve with higher loads.

To be on the safe side, I ran a couple of tests with -10dBFS and -20dBFS 1kHz sine waves and checked the distortions with the oscilloscope. The loaded clipping level has always been 1.32Vpp, meaning that the distortions are not dependent on the amplification/volume setting per se, but just on the output power. Albeit the shape of wave is slightly less "nice" compared to 0dB for example, I was able to go up the the max amplification (12dB) with no clipping error on the -20dBFS track. The conclusion - the culprit for the clipping is the last stage (the amplifier) in the CS audio chip.

These being said, I see little point in shifting the volume range. The current setup may be not the most appropriate for a 16ohms load as distortions are significant for volumes above -3dB, yet for higher impedance loads this will not be applicable (did not have the time to measure the effects with higher loads). In the same time, most likely the majority of the earphones on the market have an impedance close to 16ohms and many balanced armatures can go significantly below this depending on the frequency of the signal...

As for the volume limit, while in practice I personally find 12dB overkill and I prefer to limit that, there may be some circumstances in which this can be useful (such as high impedance/low sensitivity headphones). I still believe that including a volume limit option in the Rockbox audio settings menu would add value, so I'll look into this.


Comment by Albert Barca (axismundi) - Monday, 13 February 2012, 01:05 GMT
I meant to say 790mVpp and not 790Vpp...
Comment by MichaelGiacomelli (saratoga) - Monday, 13 February 2012, 01:34 GMT
>These being said, I see little point in shifting the volume range.

I agree, moving the zero level seems necessary in light of your new measurements. Very interesting results.

> I still believe that including a volume limit option in the Rockbox audio settings menu would add value, so I'll look into this.

You may want to ask on the mailing list before you go through the effort. In the past years this option has been rejected, and the project as a whole is generally hostile to adding more settings (many hold the general opinion that we already have too many). That said, I don't know what people think these days.
Comment by Albert Barca (axismundi) - Monday, 13 February 2012, 22:07 GMT
> You may want to ask on the mailing list before you go through the effort. In the past years this option has been rejected, and the project as a whole is generally hostile to adding more settings (many hold the general opinion that we already have too many).

Thanks for the heads-up, Michael. I also remember reading something along these lines on the Rockbox website (I think it was on the forum). I understand why people may be reluctant to adding features to Rockbox when their value may not be apparent and I think it's the right thing to do, the only tricky element being the perception of the added value. I think I'll give it a try regardless, it would be useful for me and it should be a good learning exercise. If I succeed I can check with the rest of the community whether they would like that feature added or not.

Loading...