I always assumed that ov_read_float() would get me samples in the range of [-1,1), and anything below or above that can be clamped (or clipped in the final conversion to an integer format.) However, I recently saw this: https://github.com/LaurentGomila/SFML/issues/310#issuecomment-9974550 Apparently, there are Vorbis streams that use float samples with values in the range of [-32768, 32767]?
On Mon, Jan 07, 2013 at 08:53:56PM +0200, Nikos Chantziaras wrote:> Apparently, there are Vorbis streams that use float samples with values > in the range of [-32768, 32767]?GIGO. -- Paul Martin <pm at nowster.me.uk>
On Mon, Jan 07, 2013 at 11:50:20PM +0200, Nikos Chantziaras wrote:> On 07/01/13 23:23, Paul Martin wrote: > > On Mon, Jan 07, 2013 at 08:53:56PM +0200, Nikos Chantziaras wrote: > > > >> Apparently, there are Vorbis streams that use float samples with values > >> in the range of [-32768, 32767]? > > > > GIGO. > > So the answer is no? Vorbis float values always have a nominal range of > [-1,1) and I can always clamp/clip to that?If you feed in "normalized to full scale" values to any lossy encoder, you are likely to get overshoots on decoding. It's good to be aware that this might happen and to do your volume scaling (playback gain) in the floating point domain before you convert to integers. You'll often notice this on YouTube videos where they clip audibly on playback due to insufficient headroom. -- Paul Martin <pm at nowster.me.uk>
xiphmont at xiph.org
2013-Jan-12 01:16 UTC
[Vorbis] Fwd: What's the value range of float samples?
Oops, meant to reply on-list. ---------- Forwarded message ---------- From: <xiphmont at xiph.org> Date: Fri, Jan 11, 2013 at 8:15 PM Subject: Re: [Vorbis] What's the value range of float samples? To: Gregory Maxwell <gmaxwell at gmail.com>> ?1 on the rails signals can actually clip in the DAC as well? usually > if the actual samples are at 0dBFS then there are intersample peaks > above it, there is basically no getting it right if the signal is > already at the rails.I'd have thought the output buffer is more likely the problem. But whichever it is, I own one such DAC. Monty