QUOTE(Lyx @ Dec 9 2005, 04:32 PM)
By the default setting, foobar scales the signal according to the gain value - and if it then still clipps according to the peak-info, then it is further scaled down until it doesn't clip. While this doesn't sound like a big deal, it can be a big deal with mp3s which are not overcompressed - because almost every encoded mp3 clips upon decoding... peak values like 1.1-1.2 are not unusual.
Hmm. Okay. Doesn't this change the volume of the track though? Seems to me that it would ruin the "volume levelling" effect on some songs that clip heavily. Minor clipping might be preferable in some cases.
QUOTE(Lyx @ Dec 9 2005, 04:32 PM)
The thing is - if it would be the case that there is no reliable way to make sense of the peak-info in RVA2, then what to do with it? Throw it away? Then the signal may clip, but you get "clean" rgain-data..... or simply asume a peak of 1.2.... that would be enough with most mp3s - but then the rgain-data would just be a dirty guess and thus be "incorrect".
Assuming you can't get the peak info because it's not there or the format isn't well defined, you can either a) let 'er clip, or b) guess, or c) scan for peak data and add it in a format you like.
However, we can probably make a pretty good guess at what format the peak data is in. If the track is marked as having 16 bit samples and the peak is a 16 bit value, well, QED, right? Pretty logical guess there, especially if the value is near the max sample value. Or, if the peak is 32 bits and the bit depth of the track is not, then it's probably a floating point number. Even in the case where the track does specify itself as having used 32 bit samples (certainly not the most common case), a float is going to have a different "look" to it than a sample value would. An IEEE 32 bit float is unlikely to have a particularly high exponent in this case (since our number is hopefully close to 1.something), so a range of values can be defined where we assume it's a float, otherwise we assume it's a sample value. Basically assume it's a float and if the value does not come out between +-1.4 or so, then it's not a float.
Not a great way to do things, I admit, but it covers most cases.