[vorbis-dev] Re: [vorbis] Amplify Ogg files without decode/encode

Beni Cherniavsky scben at techst02.technion.ac.il
Wed May 16 11:19:57 PDT 2001



On 11 May 2001, Mike Coleman wrote:

> Michael Smith <msmith at labyrinth.net.au> writes:
> > I think it should be possible (though maybe difficult) to adjust volume
> > without a full reencode. Not sure of details, though. Would need to read
> > some source again.
> 
> It seems like it should be possible.  I was hoping, though, that there was
> a constant stored in each frame that could be easily updated; it doesn't look
> like it's that easy.
> 
How about just scaling all the codebook values?  Acording to your "Vorbis
Illuminated" (which was very helpful to me ;), both the floor and the
residue are encoded through the codebooks.  Then simply changing the
codebook should scale the whole sound - or do I miss something like a
logarithmic vs. linear difference in the meaning of the values encoded for
the floor and the residue?  Also it will be lossless!

What kind of codebook does vorbis currently use?  From the same
illuminating doc I see that this will work for any but the elided mapping
which must have unity steps between values (should be fixable by changing
into an implicitly populated one).

This of course only handles a constant amplification for the whole stream,
diallowing local changes (e.g. fade in/out that somebody mentioned).  But
fading by altering per-packet voluming is bad anyway - it will introduce a
stepiness that will be smoothed by the windowing function but not
completely.

> Probably you could do something like extract the floor and residue, scale them
> both, and reencode, but that's so much work it's probably simpler to just
> decode/reencode.
> 
Extracting and reencoding the floor and residue will be lossy unless e.g.
you scale by an integer and use an elided mapping for the codebook, or
have codebook values that are a geometric series and you happen to scale
by a power of the series factor...  In other words the cases when
you can do it losslessly are very rare.  A full decode/reencode is of
course always lossy.

One may compine a ratial reencode for fading the ends with a codebook
scaling to losslessly amplify the whole sound.


-- 
Beni Cherniavsky <cben at crosswinds.net>
                 (also scben at t2,cben at tx in Technion)

10001110111100111100001001010 m/s

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.




More information about the Vorbis-dev mailing list