QUOTE(Robin @ Oct 20 2005, 07:41 AM)
I had a very low volume (max peak was about -23 dB) file in mono that when compressed with flac -8 gave a compression of about 0.192 if I remember correctly.
I then normalized the file to have a maximum of 0.0 dB and the flac file turned out to be 0.4xx something which made the resulting file more than double the size for the low-volume one.
Why is this? Isn't the change from sample to sample the same for the low volume one as for the high volume one? And the difference is really significant, so it can't really be that the sample to sample change is slightly different, can it?
This really isn't a problem for me, I'm more curious

When you apply a positive gain to a file you are raising the noise floor. To your ears or for a perceptual codec, this makes little difference since, essentially, the S/N ratio is unchanged. But a lossless codec has to encode all the noise exactly and that takes bits. In particular, a 23 dB gain corresponds to 3.8 bits/sample, increasing the compression ratio by about .24.
In theory, a lossless codec could detect that all the samples were multiples of some gain factor (plus or minus 1 if dithering was applied). Then you could apply an arbitrary gain for little cost. AFAIK, nobody's been crazy enough to actually try implementing such a scheme.
As a special case of this idea, FLAC will detect if some number of low-order bits are always zero and code that very efficiently. So if you can arrange to multiply all your samples by a power of 2, you can get the gain at the cost of a few bits per frame. In the case of your file, the best you could do without clipping would be to multiply all the samples by 8, corresponding to a 18dB gain.
If you really wanted the full 23dB gain, you could apply the maximal gain that would keep all the samples under 1/8 full-scale (i.e. approximately 5dB) before multiplying by 8. This would cost approximately .8 bits/sample or a .05 increase in compression ratio. The downside would be an 18dB increase in distortion/dithering noise compared to just applying the 23dB gain in one step. If dithering were used in the gain process, this would probably still be quite acceptable.
--John