[Vorbis] What's the value range of float samples?

Gregory Maxwell gmaxwell at gmail.com
Fri Jan 11 08:53:03 PST 2013


On Fri, Jan 11, 2013 at 10:41 AM, Nikos Chantziaras <realnc at gmail.com> wrote:
> Are there any smarter strategies for doing this?

Yes, a limiter.

Updating your gain adjustment only when you would have otherwise
clipped doesn't tend to damage the audio much, as the clipping tends
to mask the volume change.

> I thought of searching the current playback buffer to find the peak, but

This is called a look-ahead limiter. I'm somewhat skeptical of the
value of lookahead in limiters because while they reduce the objective
distortion at least when the lookahead is not infinite they may be
replacing a less audible distortion with a more audible one (a kind of
pre-echo).

> I suppose ReplayGain could help here for files that do have that information in them?

Using the replaygain peak normalization will result in wildly
inconsistent volume levels, as the peak differences created by lossy
compression are pretty random.

For opusfile (the analogs api to vorbisfile for vorbis) we've talked
about including a limiter— Opus' more sophisticated lossy compression
tends to cause a bit more peak inflation than Vorbis' does— and we'll
probably do that eventually.  Generally my recommendation for best
practics is twofold:  Encode things at a pre-normalized loudness that
has enough headroom (either at replaygain or EBU R128 levels) so that
clipping is almost never a concern, and apply a limiter just in case.


More information about the Vorbis mailing list